Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Html Helper in CakePHP

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 155
    Comment on it

    If you want to make your page more reliable ,then Use HtmlHelper instead of html tag in your (xyz.ctp). CakePHP Helper will enable your application more light & flexible. By using these HtmlHelper ,we can create well formed markup in our Cake PHP page.

    html helper for image in Cake PHP

    echo $this->Html->image('logo.png', array('alt' => 'Mylogo'));
    
    //output in view source: <img src="/img/logo.png" alt="Mylogo" />
    

    html helper for link

    echo $this->Html->link(
        'Enter',
        '/pages/home',
        array('class' => 'button', 'target' => 'blank')
    );
    
    //output in view source (ctrl+u):  <a href="/pages/home" class="button" target="blank">Enter</a>
    

    html helper for div tag

    <?php
    echo $this->Html->div('error', 'this is html helper div.');
    ?>
    
    // Output: <div class="error">this is html helper div.</div>
    

    Html helper: Script

    echo $this->Html->script('http://code.jquery.com/jquery.min.js');
    
    //output: <script type="text/JavaScript" href="http://code.jquery.com/jquery.min.js"> </script>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: