Procedural File: function.modulejavascript.php
Source Location: /Theme/plugins/function.modulejavascript.phpClasses:
Page Details:
Zikula Application FrameworkTags:
smarty_function_modulejavascript [line 56]
|
Smarty function to include module specific javascripts
available parameters:
- modname module name (if not set, the current module is assumed) if modname="" than we will look into the main javascript folder
- script name of the external javascript file (mandatory)
- modonly javascript will only be included when the the current module is $modname
- onload function to be called with onLoad handler in body tag, makes sense with assign set only, see example #2
- assign if set, the tag and the script filename are returned
Example: <!--[modulejavascript modname=foobar script=openwindow.js modonly=1 onload="dosomething()" assign=myjs ]--> Output: nothing, but assigns a variable containing several values: $myjs.scriptfile = "modules/foobar/pnjavascript/openwindow.js" $myjs.tag = "<script type=\"text/javascript\" src=\"modules/foobar/pnjavascript/openwindow.js\"></script>" $myjs.onload = "onLoad=\"dosomething()\""; Possible code in master.htm would be:
... <!--[ $myjs.tag ]--> </head> <body <!--[ $myjs.onload ]--> > ...
which results in
... <script type="text/javascript" src="modules/foobar/pnjavascript/openwindow.js"></script> </head> <body onLoad="dosomething()" > ...
if foobar is the current module.
Tags:
Parameters
| array | $params | All attributes passed to this function from the template |
| object | &$smarty | Reference to the Smarty object |
