Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2007
    Posts
    32
    Plugin Contributions
    0

    help question jQuery & js on Home Page

    Using 1.3g, I'm trying to get some jQuery modules (Novis slider). loaded on the HOME page. They're working just fine on other pages, but the home page seems to be difficult.

    I've tried the template/override method unsuccessfully. jQuery loads just fine, but using Firebug and clicking on the jquery.module.js brings up the root site's home page--that is I see the HTML for the root index.php page (Zen Cart is installed at http://www.example.com/store).

    So, I've tried hard coding, using relative paths, etc. Just wondering if there's something terribly obvious I'm missing with regard to getting these things to work on the HOME page.

    Any suggestions?

  2. #2
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: jQuery & js on Home Page

    Quote Originally Posted by 3DPeruna View Post
    Using 1.3g, I'm trying to get some jQuery modules (Novis slider). loaded on the HOME page. They're working just fine on other pages, but the home page seems to be difficult.

    I've tried the template/override method unsuccessfully. jQuery loads just fine, but using Firebug and clicking on the jquery.module.js brings up the root site's home page--that is I see the HTML for the root index.php page (Zen Cart is installed at http://www.example.com/store).

    So, I've tried hard coding, using relative paths, etc. Just wondering if there's something terribly obvious I'm missing with regard to getting these things to work on the HOME page.

    Any suggestions?
    If you add jscript_ to the front and place the script file in your template script folder it will load and run on every page...site wide. includes\templates\YOUR_TEMPLATE\jscript\jscript_jquery.module.js

    If you called to it differently on other pages, be sure to remove the calls or it will load a second time.
    Dave
    Always forward thinking... Lost my mind!

  3. #3
    Join Date
    Nov 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: jQuery & js on Home Page

    Dave,

    Yes... I know that. I don't want it on every page, just the front page. Like I said, I've got other javascript loading on the other pages as it's supposed to. It's getting something to load ONLY on the home page that I'm struggling with.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: jQuery & js on Home Page

    How about being a LOT more specific about what EXACTLY you're trying to do?
    .

    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.

  5. #5
    Join Date
    Nov 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: jQuery & js on Home Page

    It's not too complicated. I'd like to get the Nivo jQuery slider working on the FRONT page only (but I'm open to other sliders, too).

    I've got the script showing up in the header - that part is working just fine. View page source and the script shows as loaded. Sort of.

    In the includes/modules/pages/index/jscript_index.php file I have the following:
    Code:
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
    <script type="text/javascript" src="jquery.nivo.slider.pack.js"></script>
    .

    jquery-1.5-min.js loads just fine. But the slider doesn't work - I get a javascript error, the kind you get when your .js file isn't working. Clearly the script isn't working, and it doesn't appear to be loading. The weird part is that it shows up in both IE and Firebug under scripts, but when I click to look at it (like I can with the main jQuery .js file), it shows a page with the following tag in the title:

    Code:
    <title>Nothing found for  Store Jquery Nivo Slider Pack Js</title>
    So, how do I get the Nivo slider script to actually load?

  6. #6
    Join Date
    Nov 2007
    Posts
    32
    Plugin Contributions
    0

    red flag Re: jQuery & js on Home Page

    New Info:

    Just to make sure I knew it was a path/loading issue, I pasted the script into my html_header.php file with some PHP wrapped around it make sure it only loads on the home page. The script works just fine. It's a path/loading issue.

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

    Default Re: jQuery & js on Home Page

    Well, you're not specifying a path to your nivo.slider.pack.js file. That could explain why it's not getting loaded.

    As for loading *only* on the home page, wrap some PHP code around those 2 lines to check whether $is_home_page is true or not, and only load if it's true.
    .

    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.

  8. #8
    Join Date
    Nov 2007
    Posts
    32
    Plugin Contributions
    0

    Default Re: jQuery & js on Home Page

    Yep... that was it. I changed it to the following:

    PHP Code:
    <script type="text/javascript" src="includes/modules/pages/index/jquery.nivo.slider.pack.js"></script> 
    and all is happy! Thank you!

 

 

Similar Threads

  1. jQuery Slide Show for home page
    By delia in forum All Other Contributions/Addons
    Replies: 11
    Last Post: 6 Jan 2011, 01:55 PM
  2. need help with main page & home page
    By shahram in forum General Questions
    Replies: 1
    Last Post: 20 Aug 2010, 01:27 AM
  3. Can I change my home page to index.php?main_page=page&id=1 ?
    By Derek_ICD in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 13 Oct 2009, 08:06 PM
  4. Replies: 1
    Last Post: 22 Jan 2009, 11:24 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR