Issues

ZF-2426: New Zend_View placeholders allow duplicates...

Issue Type: Improvement Created: 2008-01-13T00:09:09.000+0000 Last Updated: 2010-08-22T16:00:16.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Travis Elkins (chidera) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: - ZF-2690

Attachments:

Description

Hi,

I have just recently begun to use one of the more recent snapshots so that I could start to use Zend_Layout and the new, related functionality. It's great so far, by the way.

But, I've got a problem with some of it....

I have only observed it when using one of the new "concrete placeholder implementations": HeadScript. Whenever I append a new file, it's possible that two entries are added. That really bugs me.

What I'm trying to do is to take advantage of the new features by only adding script files when and where I need them, without concern for what's already included. On the positive side, it works great in that I'm getting what I need quite simply. But, when I look at the source, I sometimes see duplicate entries. That is, one view script will need somefile.js, and so it calls ``` Now, when the request completes and I view the source, I see two references listed for somefile.js. :-|

Can one prevent this? I've poked around a bit through the few examples "out and about" as well as the snapshot docs, the source, and php.net's ArrayObject documentation (which is a little on the light side). I wasn't able to find anything, but perhaps I've missed it.

Is it bad...? I have to admit, I don't know what it would mean to have the same file referenced more than once. Is there a need for this? Will the browser see that it's already fetched the first one and then ignore the second? Or will it go after both?

So...I would prefer to see HeadScript automatically ignore duplicates. If that's the default and there's good reason to allow duplicates sometimes, then that could be configurable. Or, the opposite: duplicates are allowed by default, but ignoring them could be configurable.

What does everyone else think about the whole thing...?

Take care...

Comments

Posted by Travis Elkins (chidera) on 2008-01-13T00:11:52.000+0000

I just looked at what I submitted and I must have inadvertently introduced some strikethrough markup. It wasn't intended, so please ignore the fact that some text has strikethrough format.

Sorry. :-|

Posted by Andries Seutens (andries) on 2008-01-28T06:48:45.000+0000

I've edit the issue to get rid of the strikethrough markup.

Posted by Andries Seutens (andries) on 2008-01-28T08:02:06.000+0000

Assigned to Matthew, he will have a better idea what to do with this. I personally would suggest adding an extra parameter or a new method to append unique.

This would only inject the headScript element when the filename is unique and each of the attributes matches.

Posted by Bart Dens (dancet) on 2008-01-31T00:39:21.000+0000

I would love to have a fix for this as well, as this is sort of a blocking issue for me. I'm using ExtJS and have a method that is loading dependencies, but all these scripts are loaded for each extjs element I'm including...

If wanted, I can have a look at this issue as well.

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-01T11:26:00.000+0000

Updating version to next minor release, as this functionality won't even be released until then.

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-20T11:05:55.000+0000

Fix committed to trunk.

Posted by Sergio Vaccaro (hujuice) on 2010-08-22T15:57:59.000+0000

The issue is still there.

In the postDispatch function of a plugin I would write:

<pre class="highlight">

In this way, if I have a forward, the plugin is executed twice (or more) and I've a double (or more):

Regards, Sergio

Posted by Sergio Vaccaro (hujuice) on 2010-08-22T16:00:15.000+0000

More... the workaround will be horrible code... :)

Sergio

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts