Elxis CMS Forum
Support => Elxis 4.x/5.x DEV => Topic started by: speck on November 10, 2012, 12:12:49
-
i'm tired, furious, and i become crazy ;D
when i need use eFactory::getDocument()->addJQuery() ???
scenario
eFactory::getDocument()->addJQuery() in template use jquery, in module use jquery and in plug-in use jquery, without cahce all works right.
with cache, all things use jQuery not works or works badly. this because in tags twice http://localhost/includes/js/jquery/jquery-1.7.1.min.js and not once how is without cache.
i get a look also at the files of cache of pages with pug-in use jQuery and modules, i found
$head = array(
array('type' => 'jsfile', 'contents' => 'http://localhost/includes/js/jquery/jquery-1.7.1.min.js').
ok if eFactory::getDocument()->addJQuery() is in a module.... the module is possible to not cache, but a plug-in ???
the problem if solved:
if in only emplate i have eFactory::getDocument()->addJQuery(), and this instruction is not in modules but overall in plug-in
but if in template there isn't eFactory::getDocument()->addJQuery() but overall in the extension works with jquery , these doesn't works.
how can solve this problem overall for plug-in.
there's some instruction to not call if eFactory::getDocument()->addJQuery() exist in tags so is not copied in the cache file???
i thing this is most important for people want use cache.
-
I might need to add one more check routing in cache, I will see this in a few minutes.
Till then, some internal technical information regarding Elxis cache.
Elxis 4.x has a very clever file caching system, no other cms works like that.
Let's say you have module X which appends javascript and/or css on the document's header using the elxisDocument library's methods.
When a module (or anything else), adds something to the document's headers, Elxis triggers an observer (private elxisDocment::observer). This system observes and writes down everything that the extension appended on the document headers. If the extension's output was cached by elxisCache the observer put the things the extension placed in the document's headers in the cache file too. If it wouldn't do that the cached version wont had the required js/css info on the head section on the page and the extension would be displayed good. So when the extension is retrieved from the cache elxisCache reads the $head array saved in the cache file and puts back to the page head section the head data. In your case the problem most probably is generated because the jquery is added as a library (elxisDocument::addLibrary) and not as an external js file (elxisDocument::addScriptLink). I will check this now and notify you in a while with any fixes might be required. BTW jquery was updated to 1.8.2.
-
Problem fixed!
Replace existing files in includes/libraries/elxis/ with those I attach.
Delete (from elxis admin console) cached files in repository/cache/ and should work fine.
-
Hi,
at first sight, it seems that the Browse EDC doens't work with this update.
-
Yes, sorry. The updated elxisDocument requires more things to be updated (eg. jquery from 1.7.1 to 1.8.2).
We just released the final stable version with all updates including. You can get jquery 1.8.2 from there or wait for an update patch.
The update patch for all beta versions to the stable one is ready but we will release it in the afternoon. Please wait a few hours...
-
Ok, thanks for your response.
By the way, there're also a new update for ckeditor, but I'm not sure if it's important.
Thank you.
-
In your case the problem most probably is generated because the jquery is added as a library (elxisDocument::addLibrary) and not as an external js file (elxisDocument::addScriptLink). I will check this now and notify you in a while with any fixes might be required. BTW jquery was updated to 1.8.2.
yes:
in few words
i use eFactory::getDocument()->addJQuery() or $eDoc->addJQuery() to call the basic jquery file "jquery-1.7.1.min.js"
seeing all extensions in the base package i used always this.
elxisDocument::addScriptLink i use to add the files .js necessarily to works the extension example: rssfeed.js, naturally i'll check all with
if (!defined('MODULE_EIRSSFEEDS')) { bla bla bla bla;
define('MODULE_EIRSSFEEDS', 1); } in way to not call twice the files .js & .css and js code with variables passed to file .js, if i have two or more same modules in the same page.
now i'll try making some test. if i'll encounter problems i'll advise you.
if works all right i need re-fix all my extension to update in EDC
thanks a lot as ever ;)
===============================================
WOOWWW
GREAT
WORKS ALL RIGHT