Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Docs for page function.modulejavascript.php

Procedural File: function.modulejavascript.php

Source Location: /Theme/plugins/function.modulejavascript.php

Classes:



Page Details:

Zikula Application Framework



Tags:

version:  $Id: function.modulejavascript.php 24383 2008-06-12 14:15:02Z markwest $
copyright:  (c) 2004, Zikula Development Team
link:  http://www.zikula.org
license:  GNU/GPL








smarty_function_modulejavascript [line 56]

string smarty_function_modulejavascript( array $params, object &$smarty)

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 ]--> Output: <script type="text/javascript" src="modules/foobar/pnjavascript/openwindow.js">

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:

return:  The tag
author:  Frank Schummertz
since:  13. June 2004


Parameters

array   $params   All attributes passed to this function from the template
object   &$smarty   Reference to the Smarty object
[ Top ]


Packages:

Files:

Classes: