Totally Zenned
- Join Date:
- Feb 2007
- Location:
- South Florida, USA
- Posts:
- 1,375
- Plugin Contributions:
- 0
Loading a javascript site-wide
I want to write unobtrusive javascript for Zen Cart.
In other words, javascript that is not hacked into common templates like tpl_main_page.php or html_header.php
I already know how to add a javascript to header unobtrusively.
Now comes the body part, usually hacked into tpl_main_page.php.
There is not a module for this page in includes/modules/pages/, where I can insert the script.
From the wiki:
Zen Cart's™ modular system can be used to insert <BODY> tag "onload" event handling on a site-wide or per-page basis very easily. Within your /includes/templates/YOURTEMPLATE folder, you can create a /jscript/on_load folder for this purpose.
Any on_load_*.js file in this directory can be used to modify the body tag with a javascript on_load() function.
Some questions about this:
- Does this .js file skip the <script></script> tags like the jscript_*.js files in the jscript folder.
- Do I need to write a function? That wouldn't be a problem.
My question arises because I need to input the following:
<a href="http://www.instantssl.com" id="comodoTL">SSL</a>
should I skip the <script> tags and enter the anchor as shown?
I am updating a Zen Cart contribution to use unobtrusive javascript, so please help.
Thanks.
[argentiniansupermarket.com