Question

I'm setting a local path for jQuery in my layout. Then adding another js file using appendFile, but it's not adding the file I'm appending.

in layout:

$jquery=$this->jQuery();
$jquery->enable(); // enable jQuery Core Library
$jquery->setLocalPath($this->baseUrl().'/js/jquery-1.3.2.min.js');
echo $jquery;
echo $this->headScript();

In my view:

$this->headScript()->appendFile($this->baseUrl().'/js/jquery.corner.js');

thanks for any help

No correct solution

OTHER TIPS

You need to put the following line in your action, instead of your view:

$this->view->headScript()->appendFile($this->view->baseUrl().'/js/jquery.corner.js');

The line echo $this->headScript(); is being executed before any of your view code is, so it won't take your appendFile() statement into account. If you put it in your action, the action code is called before the layout and view are rendered, so it will take it into account.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top