ZF-2690: Unique CSS, javascript... files in head helpers
Description
When you use
echo $this->headScript(); echo $this->headStylesheet();
in template files maybe is right to filter printed content with something like "array_unique". For example:
I'm appending stylesheets in a controller class in this way: $this->view->headLink()->appendStylesheet('style.css'); $this->view->headLink()->appendStylesheet('style2.css');
Then the action in this controller makes a forward to another action where you find this code: $this->view->headLink()->appendStylesheet('style.css');
In the view template I'm using: echo $this->headStylesheet()
Now, the headStylesheet() function will print 2 times the link to "style.css" ! why? I think is better if this function makes a "unique print" of different files. Same "problem" with headScript() and headMeta() with same keys
try for example:
$this->view->headMeta()->appendName('robots', 'index, follow'); $this->view->headMeta()->appendName('robots', 'noindex, nofollow');
$this->view->headScript()->appendFile('/js/prototype.js'); $this->view->headScript()->appendFile('/js/prototype.js');
Comments
Posted by Jon Whitcraft (sidhighwind) on 2008-02-20T07:37:34.000+0000
Mark as duplicat of ZF-2426
Posted by Jordan Ryan Moore (jordanryanmoore) on 2008-02-20T13:52:21.000+0000
Fixed in trunk.
Posted by Wil Sinclair (wil) on 2008-03-31T16:10:03.000+0000
Please evaluate and categorize as necessary.