Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Where to enter a javascript that goes in header?

    I have been reading the wiki for javascript but maybe because of my lack of practice I still don't get clearly certain issues.
    For example, I want to enter a js in a sidebox, it is pretty clear to me how to enter the <body> part, but not the <head> part, that is for a script that has two parts, of course.
    Thanks.

  2. #2
    Join Date
    Dec 2006
    Location
    Athens - Greece
    Posts
    71
    Plugin Contributions
    0

    Default Re: Where to enter a javascript that goes in header

    Try html_header.php located in templates/custom_template/common.

    This is where the headers (<head> </head>) are generated.

    I don't know if that's the best way, but it worked for me.

    George

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Where to enter a javascript that goes in header

    Quote Originally Posted by pelasgos View Post
    Try html_header.php located in templates/custom_template/common.

    This is where the headers (<head> </head>) are generated.

    I don't know if that's the best way, but it worked for me.

    George
    That would be an ugly hack, and doesn't use the built-in autoplugin capability.


    As the wiki article states, as well as the docs in the /docs/ folder of your Zen Cart files, you simply create a jscript_whatever.js file in the jscript folder of your template, and its contents will be automatically referenced in the <head> section of your pages. The article goes into detail of various alterations supported.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Where to enter a javascript that goes in header

    Quote Originally Posted by DrByte View Post
    That would be an ugly hack, and doesn't use the built-in autoplugin capability.


    As the wiki article states, as well as the docs in the /docs/ folder of your Zen Cart files, you simply create a jscript_whatever.js file in the jscript folder of your template, and its contents will be automatically referenced in the <head> section of your pages. The article goes into detail of various alterations supported.
    AHA! To install the Comodo Corner of Trust Logo I used the ugly hack, it works, but...it might not be best practice.
    The Comodo Sidebox mod. also uses the ugly hack, might have to rewrite that one too.
    I will test the other alterations too.
    Thanks for answer.
    And thank too to pelasgos, I appreciate your good will.
    When I say "ugly hack" I am not trying to be demeaning, just a quick way to reference it, I think that is DrByte's demeanor too.

  5. #5
    Join Date
    Dec 2006
    Location
    Athens - Greece
    Posts
    71
    Plugin Contributions
    0

    Default Re: Where to enter a javascript that goes in header?

    An ungly hack is always an ungly hack.

    It worked for me in the past, but now that DrByte showed the right way, I give it a try..

    Thanks for pointing it DrByte, and thanks ckosloff for being the "triger" for that.


    "...Each day I grow older, and learn something new..." (Solon the Athenian)

  6. #6
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Where to enter a javascript that goes in header

    Quote Originally Posted by DrByte View Post
    That would be an ugly hack, and doesn't use the built-in autoplugin capability.
    As the wiki article states, as well as the docs in the /docs/ folder of your Zen Cart files, you simply create a jscript_whatever.js file in the jscript folder of your template, and its contents will be automatically referenced in the <head> section of your pages. The article goes into detail of various alterations supported.
    I tried loading a javascript the way you describe.
    It worked, but...since IH2 loads its own jscript in same folder it broke the hover functionality in IH2.
    Something to be aware of...

  7. #7
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Where to enter a javascript that goes in header?

    All right, it won't break IH2 if the jscript includes the <script> tags and is renamed to the .php extension.

 

 

Similar Threads

  1. Replies: 2
    Last Post: 18 Sep 2012, 11:43 AM
  2. USPS Shipping module URLs - Where to enter them?
    By ichthyous in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 25 Jun 2010, 12:03 AM
  3. Paypal Problems - No where to enter Credit Card Information
    By rosa_o_clifford in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 18 May 2009, 01:57 AM
  4. module where manufacturer can enter own data?
    By johnk in forum General Questions
    Replies: 1
    Last Post: 28 Feb 2008, 07:41 AM

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