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,655
    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.
    See and test drive Zen Cart's free templates at zencarttemplates.info

    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,655
    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?
    See and test drive Zen Cart's free templates at zencarttemplates.info

    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
    60,305
    Blog Entries
    4
    Plugin Contributions
    51

    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!
    Donations always welcome: www.zen-cart.com/donate

    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,655
    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.
    See and test drive Zen Cart's free templates at zencarttemplates.info

    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
    60,305
    Blog Entries
    4
    Plugin Contributions
    51

    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!
    Donations always welcome: www.zen-cart.com/donate

    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. Publishing Changes from Test site to live site
    By MyGreyGoose in forum Installing on a Linux/Unix Server
    Replies: 7
    Last Post: 22 Jun 2007, 12:09 AM
  2. Store Banners Site wide
    By BreaJR in forum Basic Configuration
    Replies: 0
    Last Post: 20 Sep 2006, 02:12 AM

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
  •