Page 1 of 4 123 ... LastLast
Results 1 to 10 of 38
  1. #1
    Join Date
    Jan 2010
    Location
    Columbus, Ohio
    Posts
    19
    Plugin Contributions
    0

    Default Inserting Code into tpl_header.php

    Hey,

    I have a quick question that I am sure is easy for someone to answer. I have zencart running on a site:

    ZenCart Store

    ...and the template I started with does not have the html_header.php file in it. So I need to insert some javascript into the tpl_header.php so I can have a popup menu at the top.
    (I did modify the template heavily in graphics but no changes outside of colors, graphics, etc.)

    How do I do this? The Javascript code is:
    Code:
    <script language="javascript">var MenuFolderName="";</script><script charset="UTF-8" language="javascript" src="sftmp6arrays.js"></script><script charset="UTF-8" language="javascript" src="sfmenutmp6ie.js"></script>
    I imagine this can't be all that difficult as I added a chat client to the header easily. I just don't know how to get the javascript to work in this file. Thanks!

    Here is all the information about it:

    Zen Cart 1.3.8a
    Database Patch Level: 1.3.8
    Fresh Installation

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,762
    Plugin Contributions
    9

    Default Re: Inserting Code into tpl_header.php

    Should be no need to edit as ZenCart loads all js that is in the js folder
    Place it in a jscript folder in your template - create folder if there isn't one
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jan 2010
    Location
    Columbus, Ohio
    Posts
    19
    Plugin Contributions
    0

    Default Re: Inserting Code into tpl_header.php

    Ok, so what would I call this folder? And I don't have to put anything in the header to call the jscript files to make the menu show up?

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,762
    Plugin Contributions
    9

    Default Re: Inserting Code into tpl_header.php

    Quote Originally Posted by drymetal
    Ok, so what would I call this folder?
    Quoting Myself
    Place it in a jscript folder in your template - create folder if there isn't one
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Dec 2009
    Posts
    9
    Plugin Contributions
    0

    Default Re: Inserting Code into tpl_header.php

    I'm having a similar issue as the one that drymetal's having. I'm trying to use the shadowbox javascript code to display images, so I need the javascript to load in the <head>. I've tried putting the shadowbox.js file in the js folder, but ZC isn't loading it automatically. Is there something else I need to do? Hope this isn't a hijack, since we're both just trying to load extra javascript into the <head> tag.

  6. #6
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Inserting Code into tpl_header.php

    Read the readme text file that is in the js folder ...
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  7. #7
    Join Date
    Dec 2009
    Posts
    9
    Plugin Contributions
    0

    Default Re: Inserting Code into tpl_header.php

    Got it! Thanks for the help, Kim.

  8. #8
    Join Date
    Jan 2010
    Location
    Columbus, Ohio
    Posts
    19
    Plugin Contributions
    0

    Default Re: Inserting Code into tpl_header.php

    Ok I did that. I created a jscript folder in the template directory. I then created a a file called: jscript_{unique_name}.php with the code just as it is in my first post inside of it.

    I read the readme file in the jscript folder of the default template - it told me to read the JavaScript Override How-To in Docs. So I read that. And it does not tell me what I need to do to get this menu to load in a specific place on the header.

    So can someone pretty, pretty please tell me what I need to do?

  9. #9
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,762
    Plugin Contributions
    9

    Default Re: Inserting Code into tpl_header.php

    I created a jscript folder in the template directory. I then created a a file called: jscript_{unique_name}.php with the code just as it is in my first post inside of it.
    Is your file java script or a php file?

    js files extention is filemame.js not filemane.php
    The code language is also js and not php
    Zen-Venom Get Bitten

  10. #10
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,251
    Plugin Contributions
    3

    Default Re: Inserting Code into tpl_header.php

    and let it dive straight into the javascript... as you are not embedding anything into a page, you do not need TAGS at the start or end of the jscript file, such as <SCRIPT type="text/javascript">
    18 years a Zencart User

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. Inserting a string into PHP
    By bhensarl in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 5 Nov 2010, 11:46 AM
  2. PHP Question: Inserting code to refer to another .php file
    By datatv in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Sep 2008, 10:24 PM
  3. Insert Image into Tpl_header.php
    By atheis in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 13 Aug 2008, 06:20 PM
  4. putting tpl_categories_css.php into tpl_header?
    By atracksler in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 26 Oct 2006, 08:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR