Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Cakephp HTMLHelper

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 42
    Comment on it

    HTMLHelper is used to make html options easier and flexible.some are the HTMLhelper examples whciha re given below.

    HtmlHelper::charset($charset=null) is used to create a meta tag.

    echo $this->Html->charset();

    HtmlHelper::css(mixed $path, array $options = array()) is ued to create a link to css stylesheet in cakephp.

    echo $this->Html->css('forms');

    its similar to

    <link rel="stylesheet" type="text/css" href="/css/forms.css" />

    HtmlHelper::style(array $data, boolean $oneline = true) is used to provide the style to css.

    echo $this->Html->style(array(
        'background' => '#633',
        'border-bottom' => '1px solid red',
        'padding' => '1px'

    HtmlHelper::image(string $path, array $options = array()) is used to create a formatted image in cakephp

    echo $this->Html->image('logo.png', array('alt' => 'CakePHP'));

    which is similar to


    HtmlHelper::link(string $title, mixed $url = null, array $options = array()) is used for creating html links.

    echo $this->Html->link(
        array('class' => 'button', 'target' => '_blank')

    Which is similar to

    <a href="/pages/home" class="button" target="_blank">Mylink</a>

    HtmlHelper::script(mixed $url, mixed $options) is used to include a script file in cakephp.

    echo $this->Html->script('mainscript');

    Which is similar to

    <script type="text/javascript" href="/js/mainscript.js"></script>

 0 Comment(s)

Sign In

Sign up using

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: