load more libraries with ezjscore

Author Message

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

Cristian Rinaldi

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

Cristian Rinaldi

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 01:13:10
Script start
Timing: Jan 18 2025 01:13:10
Module start 'layout'
Timing: Jan 18 2025 01:13:10
Module start 'content'
Timing: Jan 18 2025 01:13:10
Module end 'content'
Timing: Jan 18 2025 01:13:10
Script end

Main resources:

Total runtime0.7273 sec
Peak memory usage4,096.0000 KB
Database Queries71

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 587.9219152.6250
Module start 'layout' 0.00640.0039 740.546939.4688
Module start 'content' 0.01030.7156 780.0156658.5547
Module end 'content' 0.72590.0013 1,438.570316.1563
Script end 0.7273  1,454.7266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4675160.0002
Check MTime0.00130.1836160.0001
Mysql Total
Database connection0.00070.095810.0007
Mysqli_queries0.653989.8983710.0092
Looping result0.00080.1076690.0000
Template Total0.687394.520.3437
Template load0.00200.279920.0010
Template processing0.685394.220320.3426
Template load and register function0.00020.028710.0002
states
state_id_array0.00160.213710.0016
state_identifier_array0.00150.201220.0007
Override
Cache load0.00190.2575650.0000
Sytem overhead
Fetch class attribute can translate value0.00090.125340.0002
Fetch class attribute name0.00140.191180.0002
XML
Image XML parsing0.00340.466840.0008
class_abstraction
Instantiating content class attribute0.00000.002380.0000
General
dbfile0.00300.4143230.0001
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs