Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default is on-state look available for navigation?

    Is there a way in zen-cart to set up an on-state look for the navigation?

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: is on-state look available for navigation?

    Not built in, but anything can be coded. A test for $current_page_base == 'whatever' would give you the basis for setting a "currentPage" class, which could be styled in the stylesheet.

    The categories sidebox already has the classes for this available and ready to be styled. The Classic template uses these classes.

  3. #3
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: is on-state look available for navigation?

    I'm a real novice at PHP. So say I wanted to apply an additional class to a navigation list item using this method, how would I alter the code? Currently, I have the navigation in its own component (navigation.php) and inserting in on the main page template. Here's the basic structure for the nav items:

    <ul id="mainnav">
    <li id="nav_home"><a href="[link to home page]">Home</a></li>
    [other nav list here]
    </ul>

    I'm thinking the best way is to use the $current_page_base to add a class to the list item so that it looks like this:

    <li id="nav_home" class="currentpage"><a href="[link to home page]">Home</a></li>

    PHP-wise, how would I code that?

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: is on-state look available for navigation?

    If you're going to add code to highlight the current page link, you might as well make it not a link to itself at the same time. It's a good practice to avoid links that lead to exactly where you are - they serve no purpose.
    PHP Code:
    <?php if($this_is_home_page){ ?>
    <li id="nav_home" class="currentpage">Home</li>
    <?php }else{ ?>
    <li id="nav_home" class="notcurrentpage"><a href="[link to home page]">Home</a></li>
    <?php ?>

    <?php if($current_page_base == 'contact_us'){ ?>
    <li id="nav_contact" class="currentpage">Contact Us</li>
    <?php }else{ ?>
    <li id="nav_contact" class="notcurrentpage"><a href="[link to contact page]">Contact Us</a></li>
    <?php ?>
    There are various other things you can test for different situations, like $_SESSION['customer_id'] to tell if the customer is logged in (so you can show the login or logout link as appropriate).

  5. #5
    Join Date
    Apr 2006
    Location
    Columbus, OH
    Posts
    99
    Plugin Contributions
    0

    Default Re: is on-state look available for navigation?

    thanks. If I go that route (which seems like the best), how do I modify the links that go to ez-pages as well as product category pages? Here's the actual site to give you an idea what I mean:

    http://www.thepresidentscroogereport.com/

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: is on-state look available for navigation?

    Looks like fun!
    It would have been simpler to use the existing ez-page sidebox and footer menus, with ez-page internal links to lead to other pages, but now that you have it, you may as well keep it.

    Ez-page detection can be done like this
    PHP Code:
    if($current_page_base == 'page' and $_GET['id'] == 2){

    // <li> for Interview 

 

 

Similar Threads

  1. Replies: 1
    Last Post: 5 May 2016, 01:25 AM
  2. v151 Should TaxCloud be passing State Code or State name to TaxCloud for verification?
    By RCwebdev in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 9 Dec 2013, 10:16 PM
  3. Trying to add left navigation bar/ match ZenCart to the look of my site
    By NavPublishing in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 28 Oct 2008, 09:08 PM
  4. How can I change the look of the navigation side bar, to look like this
    By paha in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 12 Mar 2008, 04:45 AM
  5. Navigation button in the "active" state
    By kyates in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 23 Aug 2007, 12:35 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