Wednesday 16 October 2013

Zend Framework Controller Help

1. CSS from the Controller:

Add the css file from the Controller:

$view->headLink()->prependStylesheet('/css/yourstylesheet.css');

Use the above code in the controller's action to add the particular css file for the particular action.
2. Javascript from the controller:
Add the javascript file from the controller:
$this->HeadScript()->appendFile('/js/yourjsfile.js','text/javascript');

Use the above code in the controller's action to add the particular JS file for the particular action.