I am new to CakePHP and would like to know as how these lines work in Cake
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
Where do the meta tag, css and javascript files that are being fetched come from?
$this->fetch('something');
According to the cakephp book , the fetch
function is looking for blocks
named something
and echo
them.
In your example, as far as I understand , it looks for something like that in your view:
$this->Html->script('carousel', array('inline' => false));
$this->Html->css('carousel', null, array('inline' => false));
and treat it as a block.
so $this->fetch('script')
will get all the html->script(....)
and print them.
Read more : http://book.cakephp.org/2.0/en/views.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With