To learn more about using blocks for script and CSS files, refer to the documentation.
Within your view(s), you can utilize:
$this->Html->css('cake.generic')
Within your layout(s), you can utilize:
$this->fetch('css')
A layout includes presentation code that surrounds a view. Any element that should appear in all views should be placed in a layout.
Essentially, when setting up your layout, using $this->fetch('css')
will automatically include any css
blocks from your views. So, if in your views you have both:
$this->Html->css('cake.generic')
$this->Html->css('cake.special')
By using $this->fetch('css')
in your layout, both will be included. It's important to note that without defining the block content first, it will not display anything. Adding
$this->Html->css('cake.generic')
in the layout file before the block call ensures it is added if not already included in a defined view.