ZF-2690: Unique CSS, javascript... files in head helpers


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');


Mark as duplicat of ZF-2426

Fixed in trunk.

Please evaluate and categorize as necessary.