That's a good idea, although the JavascriptHelper is deprecated now.
As such, I would put in a feature request for the JsHelper via
lighthouse.

Nick

On Jul 9, 1:05 pm, Geoff Oliver <[email protected]> wrote:
> Hello,
>
> I've been working with Cake for a few years and I really like it.
> Lately, I've run into a bit of a problem with the way that the
> Javascript Helper handles some things. Specifically, the "link"
> function and it's $inline parameter. The issue I'm having is this...
>
> In an element, I am linking in javascript files, but NOT inline -
> $javascript->link('prototype',false);
> In the main layout, I am linking in javascript files, but inline -
> $javascript->link('prototype');
>
> The problem is that prototype is being included twice. The real
> problem is that I am actually including it twice, but I have no way of
> knowing at that earlier point (in the element) whether it will be
> included later (in the layout) or if it's been included yet, and I
> need it for things to happen in the element, so I don't think I have
> any other choice.
>
> I understand the behavior is because if you don't pass the $inline
> parameter as false then the Javascript Helper just returns a <script>
> tag back. If you do pass $inline false then the script is passed to
> the View. The View actually checks to see if it already has that
> script (in $this->__scripts) and if not adds it. This way the script
> will only be included once. I am thinking that it might not be a bad
> idea to add a similar check into the Javascript Helper to prevent the
> same script from being included multiple times.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to