Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    175
    Plugin Contributions
    0

    Default Removing Main navigation bar except on Main page

    Hey guys,

    I am customizing a new site and I would like the custom nav bar "the main category bar" that is usually left side to only show on the index page of the site.
    Can this be done through admin? Or do I just have make this part of the index page with html?

    Thanks in advance!
    Red
    [FONT="Comic Sans MS"]Red[/FONT]

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

    Default Re: Removing Main navigation bar except on Main page

    There won't be an admin setting for this, but it will be a simple modification to (I think) /includes/templates/your_template/templates/tpl_categories.php. I would have to check on that to make sure.
    By "index page", do you mean the home page only? All of the pages that show categories are "index" pages, in Zen Cart's terminology, so it can be confusing.

    For home page use, wrap the following code around whatever you want to control:
    PHP Code:
    if ($this_is_home_page) { //execute only on home page

    ... [ code ] ...

    //execute only on home page 

    -------

    There is an even simpler way to do this, using CSS. First, you will need to correct a typo in /includes/templates/template_default/common/tpl_main_page.php (and in your custom copy if you have one). Around line 41,

    PHP Code:
      $body_id = ($this_is_main_page) ? 'indexHome' str_replace('_'''$_GET['main_page']); 
    change the "main" to "home":
    PHP Code:
      $body_id = ($this_is_home_page) ? 'indexHome' str_replace('_'''$_GET['main_page']); 
    This may have been corrected in the source since I downloaded my test copy nine months ago; I am sure it is correct in the currently available version 1.3.7.1.

    So, that taken care of, add to your stylesheet
    Code:
    #categories {display: none;}
    
    #indexHome #categories {display: block;}
    and the categories sidebox will display only on the home page.

  3. #3
    Join Date
    Oct 2006
    Posts
    175
    Plugin Contributions
    0

    Default Re: Removing Main navigation bar except on Main page

    Thank you for your response!!! Yes I meant the home page sorry it took me so long. I t has taken a while for my client to get together her things and we are now back working on it.

    We will give this a shot trying the CSS file first!

    Renee
    [FONT="Comic Sans MS"]Red[/FONT]

  4. #4
    Join Date
    Jul 2007
    Posts
    8
    Plugin Contributions
    0

    Default Re: Removing Main navigation bar except on Main page

    Quote Originally Posted by gjh42 View Post
    add to your stylesheet
    Code:
    #categories {display: none;}
    
    #indexHome #categories {display: block;}
    and the categories sidebox will display only on the home page.
    Glenn - just wanted to say this is an awesome solution.

    I have been trying to figure out how to get sideboxes to only appear on certain pages and this is a great way to do it without messing around with the PHP code.

    It is very easy to implement for any sidebox and any page, thanks to all the default ID tags built into Zen Cart.

    Lisa

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

    Default Re: Removing Main navigation bar except on Main page

    You do need to be aware that this method still goes through the process of running the code for the sideboxes even though they are not displayed. This *might* add measurably to the page loading time, depending on circumstances. If you find speed issues, you should go to selectively disabling sideboxes in the PHP files.

 

 

Similar Threads

  1. How to add image to main navigation bar?
    By gaffettape in forum General Questions
    Replies: 2
    Last Post: 9 Dec 2009, 10:19 PM
  2. Replies: 1
    Last Post: 17 Oct 2009, 11:50 PM
  3. main navigation bar is gone
    By jeanx001x in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 13 Jun 2009, 11:35 PM
  4. Main Navigation Bar
    By kdiscrete in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 Jan 2009, 06:31 AM
  5. IE Only: Main Navigation bar halfway through header.
    By okpgreg in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 22 Sep 2008, 05:32 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