What?
$scripts_for_layout is a variable used in the CakePHP framework.
Why?
To declare the CSS/JS files specific to any page, within the page view template itself, still place them inside the header tag on the fly.
E.g. Alert.css is specific to Alerts.ctp page. This is not required for the other pages in the site. So, the user can declare the CSS file inside Alerts.ctp page using $scripts_for_layout. CakePHP places it inside the header.
When?
When you include a unique page, or a page with unique features.
How?
CakePHP includes $scripts_for_layout variable within its default template named default.ctp file within the view/layouts folder.
Add the following line to the view file to include a CSS
Html->css(“jquery.ganttView”, null, array(“inline”=>false)); ?>
This is the how you can include a Javascript
<!–?php $this->Html->script(‘date’, $inline=false); ?>