ez projects / ezjscore / forum / general / ezcss_require and ezscript_...
You need to be logged in to post messages in the forums. New users may register here.
Member since: Posts: 30 |
Friday 05 February 2010 6:48:07 pm Hi again. I tried to move the yahoo-dom-event.js, calendar-min.js, and ezdatepicker.js scripts from design.ini inside the appropriate templates, like content/edit/ezdate.tpl.
It doesn't seem to work. Is this because I use the operator outside a node view template? In the article I found a small sentence reading "* If the current view template does not support this (everything other than the content/view view, which loads node/view/*.tpl), then ezjscPackerTemplateFunctions::$persistentVariable is used instead." I don't understand, do I need to add something to my head_script.tpl? This brings me to my next question: what happens with the generated css and script files in var/cache/public? Are new files generated when ezscript_require is called inside a view template? And what if another view template calls the same scripts? How is the naming hash generated exactly? This could potentially lead to lots of large generated files. Is this covered in the cleanup script? Imho the ezjscore operators are not covered peoperly in the article (http://share.ez.no/articles/ez-pu...blish-javascript-and-ajax-framework). For the rest the article is of great help! :) Thanks! eZ Publish certified developer |
|
|
Member since: Posts: 171 |
Wednesday 10 February 2010 11:40:39 pm How exactly do you use it?
As for "* If the current view template does not support this (everything other than the content/view view, which loads node/view/*.tpl), then ezjscPackerTemplateFunctions::$persistentVariable is used instead." You don't need to do anything, the code will use a static variable on the class (ezjscPackerTemplateFunctions) if it detects that the current view does not support persistent_variable (basically if $module_result.content_info.persistent_variable is not set). -- |
|
Member since: Posts: 30 |
Thursday 11 February 2010 9:34:35 am I tried to put this in <extension>/design/standard/templates/content/datatype/edit/ezdatetime.tpl:
{ezcss_require( 'lib/yui/2.7.0/build/calendar/assets/calendar.css' )} {ezscript_require( array ('lib/yui/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js', 'lib/yui/2.7.0/build/calendar/calendar-min.js', 'ezdatepicker.js') )} and in the <head> I have {ezscript_load( ezini( 'JavaScriptSettings', 'JavaScriptList', 'design.ini' )|append( 'ezjsc::jquery' )|append( 'ezjsc::jqueryio' ) )} None of the required scripts/stylesheets get loaded when I edit a class with a datetime attribute. eZ Publish certified developer |
|
|
Member since: Posts: 171 |
Thursday 11 February 2010 10:29:51 am Could you try:
{ezcss_require( '/lib/yui/2.7.0/build/calendar/assets/calendar.css' )} {ezscript_require( array ('/lib/yui/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js', '/lib/yui/2.7.0/build/calendar/calendar-min.js', 'ezdatepicker.js') )} Urls are relative to stylesheet (javascript folder in case of ezscript* operators) folder unless you add a starting slash (then it is relative to design folder). EDIT: You also seems to be missing something like this in your "head"(example from webin): {ezcss_load( array( 'core.css', 'debug.css', 'pagelayout.css', 'content.css', 'websitetoolbar.css', ezini( 'StylesheetSettings', 'CSSFileList', 'design.ini' ), ezini( 'StylesheetSettings', 'FrontendCSSFileList', 'design.ini' ) ))} -- |
|
Member since: Posts: 30 |
Thursday 11 February 2010 11:02:36 am I already tried it with a leading slash, no succes.
I'm trying this in the admin design, and /extension/ezjscore/design/admin/templates/page_head_script.tpl is used, so it should be working. eZ Publish certified developer |
|
|
Member since: Posts: 171 |
Thursday 11 February 2010 3:04:31 pm /extension/ezjscore/design/admin/templates/page_head_style.tpl is used as well? (for the css)
-- |
|
Member since: Posts: 30 |
Thursday 04 March 2010 3:20:12 pm Sorry for the late reply, somehow I lost track of this thread.
Yes, the page_head_style.tpl is also used. I'm pretty sure the problem lies elsewhere. eZ Publish certified developer |
|
|
Member since: Posts: 171 |
Friday 05 March 2010 11:11:17 am btw: datepicker is fixed now to use ezjscore, ref: http://issues.ez.no/IssueView.php?Id=16293
-- |
You need to be logged in to post messages in the forums. New users may register here.