Forums / General / [Bug]problem with JavaScriptSettings[]

[Bug]problem with JavaScriptSettings[]

Author Message

Lagardere Active

Wednesday 26 September 2007 8:42:21 am

{section name=JavaScript loop=ezini( 'JavaScriptSettings', 'JavaScriptList', 'design.ini' ) }
<script language="JavaScript" type="text/javascript" src={concat( 'javascript/',$:item )|ezdesign}></script>
{/section}

i wrote

[JavaScriptSettings]
JavaScriptList[]=YahooUI/yahoo-dom-event/yahoo-dom-event.js

in 2 different extensions. but in the page, it shows 2 times the javascript.

more strange, i use the smileCalendar, in the design.ini, there is once

[JavaScriptSettings]
JavaScriptList[]=smileCalendar.js

but i got it twice,
why?

thanks for the answer.

Lagardere Active

Wednesday 26 September 2007 9:01:14 am

i added

$this->BlockValues["JavaScriptSettings"]["JavaScriptList"] = array_unique($this->BlockValues["JavaScriptSettings"]["JavaScriptList"]);

in line 686 in the file lib/ezutils/classes/ezini.php

to filter the double js.

any solution else ?

Xavier Serna

Wednesday 26 September 2007 9:17:11 am

Hi,

this is a known problem using settings in extensions, that get loaded twice, and you get your scripts and css included twice.
To prevent this you have to reset the array previously of adding items to it, using

JavaScriptList[]

A bug report can be found here:
http://issues.ez.no/IssueView.php?Id=10717&ProjectId=3

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205