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)