Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2007
    Posts
    24
    Plugin Contributions
    0

    Default PHP help needed: including a master navigation menu

    I have a client who runs multiple websites, and wants a common navigation menu on each of the sites. To make the menu work, I need to include a CSS and an HTML file. On the other 2 websites, I do it like so:

    Code:
    (In the header)
    <link href="/CSS/menustyle.css" rel="stylesheet" type="text/css" media="all" />
    
    (In the body)
    <!--#include virtual="/Includes/navbar.html" -->
    I can't for the life of me figure out how to do this in the PHP code for Zencart. I have figured out the location where I want to include the navbar.html file in the tpl_header.php file. However, I don't know how to write a simple include statement that shows where to look for the correct file. The menu can be displayed on every page, so it doesn't need to have if/then functionality.

    I'm sure this is really simple, but I've been trying to figure out how to do this for over an hour now.

    TIA for the help!

  2. #2
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,542
    Plugin Contributions
    19

    Default Re: PHP help needed: including a master navigation menu

    I'd say the most "Zen" way would be to do the following:
    1. create a file called tpl_header_menu.php and add all the content from your navbar.html to that file.
    2. upload that file to your includes/templates/YOUR_TEMPLATE/templates/ directory
    3. add the following line to your includes/templates/YOUR_TEMPLATE/common/tpl_header.php:
      Code:
      <?php require($template->get_template_dir('tpl_header_menu.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_header_menu.php'); ?>
    4. put your menustyle.css in your includes/templates/YOUR_TEMPLATE/css/ directory and rename it to stylesheet_menustyle.css


    That's it.

  3. #3
    Join Date
    Sep 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: PHP help needed: including a master navigation menu

    Cool, I'll give it a try. Thanks very much! Do I need to add a line to have the CSS included or is it automatic?

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

    Default Re: PHP help needed: including a master navigation menu

    Add your CSS file into your /includes/templates/NAME_OF_YOUR_TEMPLATE_HERE/css/ folder ... and rename it so that it starts with "style" and ends in ".css"

    ie:
    /includes/templates/NAME_OF_YOUR_CUSTOM_TEMPLATE_FOLDER/css/styles_for_nav.css

    Described here:
    http://www.zen-cart.com/wiki/index.p...Per-Page-Rules
    .

    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
    Sep 2007
    Posts
    24
    Plugin Contributions
    0

    Default Re: PHP help needed: including a master navigation menu

    Thank you both. I now have my dropdown menu working smoothly.

 

 

Similar Threads

  1. v150 Category's in Navigation Menu Help!!
    By Darion in forum General Questions
    Replies: 12
    Last Post: 20 Sep 2012, 12:14 AM
  2. sql syntax error 1064 - HELP NEEDED - Master Password
    By mydesignerstudio in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 20 Jul 2009, 04:22 PM
  3. Help needed - master category
    By sgallasch in forum General Questions
    Replies: 1
    Last Post: 8 May 2009, 04:53 AM
  4. layout help needed, including some IE/FF issues
    By chotaboy in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Sep 2007, 02:26 PM
  5. need help with navigation menu
    By MadPricerSales in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 1 Sep 2006, 07:25 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