Recent Topics

How to avoid loading multiple js libraries ?

Started by on Jun 13, 2008 – Contents updated: Jun 13, 2008

Jun 13, 2008 14:56    

Hi,

I'm currently working on a plugin that uses prototype.
I add it via 'SkinBeginHtmlHead()'.
But other "third-part" plugins do that as well..
Is there a way to detect if prototype is already called ?

Thanks

Jun 13, 2008 18:29

First of all, jQuery is included in b2evolution, so use that rather than prototype. Otherwise there will be conflicts and errors at worst and wasted bandwidth at best.

When you're loading js libraries, use require_js: http://doc.b2evolution.net/v-2-4/evocore/_blogs---inc---_core---_template.funcs.php.html#functionrequire_js

That will only load the js if it hasn't already been loaded (provided the first plugin that tried to load it also used require_js).

Jun 18, 2008 10:33

Thank you.
It's exactly what I was searching for.
;)


Form is loading...

Secure CMS – This forum is powered by b2evolution CMS, a complete engine for your website.