Dynamic CSS file linking to CakePHP layout

Here is peace of code that can allow you to link CSS per controller action, just place the code in to the layout head section /app/views/layouts/default.ctp:

// view specific CSS - css//.css or /css/pahes/.css linking, if CSS file exists
$action = $this->params["controller"] != 'pages' ? $this->params["action"] : $this->params["pass"]['0'];
if (is_file(APP.WEBROOT_DIR.DS."css".DS.$this->params["controller"].DS.$action.".css")) {
	   echo $html->css($this->params["controller"]."/".$action);
}