Forums / Extensions / load more libraries with ezjscore

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

eZ debug

Timing: Jan 17 2025 22:49:40
Script start
Timing: Jan 17 2025 22:49:40
Module start 'content'
Timing: Jan 17 2025 22:49:41
Module end 'content'
Timing: Jan 17 2025 22:49:41
Script end

Main resources:

Total runtime0.8771 sec
Peak memory usage4,096.0000 KB
Database Queries208

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 587.7344180.8359
Module start 'content' 0.00680.7200 768.5703663.6328
Module end 'content' 0.72680.1502 1,432.2031341.0547
Script end 0.8770  1,773.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4596210.0002
Check MTime0.00150.1666210.0001
Mysql Total
Database connection0.00070.077110.0007
Mysqli_queries0.788289.86652080.0038
Looping result0.00240.27442060.0000
Template Total0.848096.720.4240
Template load0.00220.247120.0011
Template processing0.845896.430820.4229
Template load and register function0.00020.020110.0002
states
state_id_array0.00080.091710.0008
state_identifier_array0.00120.139920.0006
Override
Cache load0.00200.2226650.0000
Sytem overhead
Fetch class attribute can translate value0.00140.164350.0003
Fetch class attribute name0.00130.151880.0002
XML
Image XML parsing0.00170.199550.0003
class_abstraction
Instantiating content class attribute0.00000.002080.0000
General
dbfile0.00300.3440340.0001
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs