Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Oct 2007
    Posts
    111
    Plugin Contributions
    0

    Default Site Wide Javascript

    I want to add some javascript that works site wide, it is a mouse trailing script. Not sure which page to add to. I tried adding to the english.php page above the <?psp tag, but it trashed my file.

    Not sure what page to add to, and where in the code it should go to avoid a conflict.

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Site Wide Javascript

    If you take a look in the docs folder that comes with the release package, there's a file in there that explains how to name javascript files and where to place them to have Zen Cart automatically pick them up and include them.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Oct 2007
    Posts
    111
    Plugin Contributions
    0

    Default Re: Site Wide Javascript

    Thanks, I did try that. I created a folder in my template folder called jscript and tried the site wide jscript, it would not work.

    then I tried making a folder called jscript/on_load
    and adding a file on_load_name.js, then i put my code inside that file, but again it would not load.

    It is either my js code or I am not performing the task correctly.

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Site Wide Javascript

    It certainly works. I use it regularly. Do you have a link to your site? And what are you naming your files?
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Oct 2007
    Posts
    111
    Plugin Contributions
    0

    Default Re: Site Wide Javascript

    http://desoto.websitewelcome.com/~penney/ is the site link

    the javascript is posted here:

    http://www.practiceboard.com/?7791938

    I named the file:
    /includes/templates/penney/jscript/on_load/on_load_cursor

    I placed ALL of that script on the practiceboard into the file on_load_cursor, and I think that is where I am going wrong.

    OR after i load that there, am I supposed to go someplace else and make an entry in a file to tell it to load the script in on_load_cursor, I thought from what I read it would be automatic if I had done the script correctly.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Site Wide Javascript

    does your file have a .js extension on the filename?
    .

    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.

  7. #7
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Site Wide Javascript

    Quote Originally Posted by traders View Post
    I placed ALL of that script on the practiceboard into the file on_load_cursor, and I think that is where I am going wrong.

    OR after i load that there, am I supposed to go someplace else and make an entry in a file to tell it to load the script in on_load_cursor, I thought from what I read it would be automatic if I had done the script correctly.
    There is no need to go anywhere else, just, as Dr Byte is gently hinting, name the file correctly by adding .js to end and Zen Cart will load it automatically.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  8. #8
    Join Date
    Oct 2007
    Posts
    111
    Plugin Contributions
    0

    Default Re: Site Wide Javascript

    I did that, now file has extension .js, however, instead of running the script that was in the practiceboard, i have

    // ;">

    in the upper right hand corner of my site. I plan to go and clear what is in the on_load_cursor.js and repaste and try that.

  9. #9
    Join Date
    Oct 2007
    Posts
    111
    Plugin Contributions
    0

    Default Re: Site Wide Javascript

    sorry long day meant upper left corner, it is there now so anyone can see not a live site yet so no problem, i tried the reload and no work, the java runs in html but won't run here.

    I tried a search for the // ;"> string in the script but could not find.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Site Wide Javascript

    "onload" stuff is intended for content that should be inserted into the <body onload="blahblah"> tag. This is normally used to trigger a certain javascript function loaded elsewhere on the page ... but never to store a complete script.

    "jscript" stuff is for javascript 'scripts' to be loaded on the page.

    So, rename your "on_load" folder to "jscript", and your "on_load_cursor.js" file to "jscript_cursor.js".
    .

    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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Implement site wide javascript
    By usr50 in forum General Questions
    Replies: 7
    Last Post: 26 Feb 2011, 03:50 AM
  2. Site wide notification options
    By growlight in forum General Questions
    Replies: 3
    Last Post: 7 May 2009, 04:02 PM
  3. Site wide markup
    By Bruce1952 in forum General Questions
    Replies: 5
    Last Post: 17 Feb 2009, 12:52 AM
  4. sITE WIDE MARKUP
    By Bruce1952 in forum General Questions
    Replies: 1
    Last Post: 16 Feb 2009, 11:29 PM
  5. Loading a javascript site-wide
    By ckosloff in forum General Questions
    Replies: 10
    Last Post: 12 Dec 2008, 06:56 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