Forums / Extensions / load more libraries with ezjscore
Cristian Rinaldi
Thursday 02 December 2010 5:23:15 pm
I'm working in a new extension and I am using ezjscore. The question I have is whether they can add other libraries besides JQuery and YUI for inclusion with ezscript_load.
Jean-Luc Chassaing
Friday 03 December 2010 12:32:12 am
Hello,
You can add other scripts adding a design.ini.append.php file in the settings directory of your extension.
like this :
[JavaScriptSettings] JavaScriptList[]=mynew.js
André R.
Friday 03 December 2010 4:07:29 am
If you want to do dynamic CDN vs local loading based on settings, then you can look at how Damien did it for jqueryUI in admin2pp project (this is similar to how ezjscore does it for yui2/3 and jquery, look at ezjscore.ini in admin2pp).
Also, if you use the setting from reply above, notice that in 4.3 two new settings was introduced so you have to specify if lib should be loaded in frontend or backend, the setting above worked in both front and back before, but you'll have to use BackendJavaScriptList[] in 4.3 and up to get it to load in admin2 design (backend). And can similary use FrontendJavaScriptList[] for frontend.
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom
Friday 03 December 2010 6:45:04 am
Thanks for the reply. I have the following problem, I have a search function but I get the following error message when I call. EzjscServerRouter Not a valid argument: "socialnetwork:: search" -------------------------------------------------- ----------------------------------- Invocation from the template: jQuery.ez ("socialnetwork:: search ', {arg1:' hi!"}, function (data) { if (data.error_text) alert (data.error_text) else alert (data.content) }); -------------------------------------------------- ----------------------------------- -------------------------------------------------- ----------------------------------- "Ezjscore.ini.append.php" [EzjscServer] FunctionList [] = socialnetwork [EzjscServer_socialnetwork] Class = LGKServerFunctions Functions [] = socialnetwork # PermissionPrFunction = disabled File = extension / socialnetwork / classes / LGKServerFunctions.php -------------------------------------------------- ----------------------------------- -------------------------------------------------- ----------------------------------- "LGKServerFunctions.php" class LGKServerFunctions extends ezjscServerFunctions{ public static function search ($ args) { if (isset ($ args [0])) { return 'Hello World, you sat me parameter:'. $ Args [0]; Else {} $ Http = eZHTTPTool:: instance (); if ($ http-> hasPostVariable ('arg1')) { return 'Hello World, you sat me post'. $ Http-> postVariable ('arg1'); } } return "Request to server completed, But You Did not send Any post / function parameters!" } } -------------------------------------------------- ----------------------------------- The strange thing is that under the invocation of the template I have another jQuery.ez ('ezjsc:: time', {postData: "hi!"}, function (data) {alert (data.content)});and it works.
Christian Rößler
Friday 03 December 2010 7:19:10 am
As the errormessage states: Not a valid argument: "socialnetwork:: search"
There is a space-character between :: and search. Or isn't it?
The following call to ezjsc::time is not being called, as the javascript was failing above?!?
Hannover, Germany eZ-Certified http://auth.ez.no/certification/verify/395613
Friday 03 December 2010 8:04:22 am
The whitespace was error only in the post, in the source code is well written.
The call to ezjsc::time is done regardless of the failure of the other call (socialnetwork::search).
thanks