Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Changing top_nav links with images

    Hi,

    I hope someone can help me, this is my first go at trying to change the actual code to create a bespoke template! I am working on dragons.digi-blue.co.uk, using version 1.3.9 h. I would like to replace the links for my top nav (home, specials, account, etc.) with images. I have already created these and added them to includes/templates/MY_TEMPLATE/images. In my tpl_header.php, I have this as:

    <?php require($template->get_template_dir('tpl_top_nav.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_top_nav.php'); ?>

    On my tpl_top_nav.php, I have this code:

    <div id="top_nav">
    <div id="tab_nav">
    <ul class="list-style-none">
    <?php
    if ($current_page_base == 'index') { $active = 'tab_active';
    } else { $active = '';
    }?>
    <li class="<?php echo $active;?>"><a href="<?php echo '' . HTTP_SERVER . DIR_WS_CATALOG;?>"><?php echo TOP_MENU_HOME;?></a></li>

    <?php
    if ($current_page_base == 'products_new') { $active = 'tab_active';
    } else { $active = '';
    }?>
    <li class="<?php echo $active;?>"><a href="index.php?main_page=products_new"><?php echo TOP_MENU_NEW_PRODUCTS;?></a></li>

    <?php
    if ($current_page_base == 'specials') { $active = 'tab_active';
    } else { $active = '';
    }?>
    <li class="<?php echo $active;?>"><a href="index.php?main_page=specials"><?php echo TOP_MENU_SPECIALS;?></a></li>

    <?php
    if ($current_page_base == 'featured_products') { $active = 'tab_active';
    } else { $active = '';
    }?>

    How can I change the code to pull up my images rather than the links? I have seen this link (http://www.zen-cart.com/showthread.p...eck+link+image) but it is a bit different from the top nav!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Changing top_nav links with images

    Looks like you have sorted this out
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: Changing top_nav links with images

    Hi Kobra,

    Thanks for the reply. No, it is not. What I would like to do is replace Home with a icon of a home, with alt text. The same with Account, replace that with a picture of a wallet, etc. I have used the Abagon template for layout, and now I am trying to amend this. Could you help with this?

  4. #4
    Join Date
    Feb 2008
    Location
    Amersham, Buckinghamshire, United Kingdom
    Posts
    141
    Plugin Contributions
    1

    Default Re: Changing top_nav links with images

    Looks like the code comes from the template you are using, so I'm not totally sure. But if you locate the language file that TOP_MENU_HOME is defined in, you can replace the the statement that looks like
    Code:
    define('TOP_MENU_HOME', 'Home');
    with this
    Code:
    define('TOP_MENU_HOME', '<img src="images/my_home_icon.gif" alt="my_alt_text" title="my_title" />');
    and similarly for all the specials etc.

    Hope this helps

  5. #5
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: Changing top_nav links with images

    Hi David,

    Thank you for the recommendation. Unfortunately when I added this, it broke the site. I loaded the home.jpg to my main images folder as well as my template images folder. Do you have any idea why this has not worked?

  6. #6
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: Changing top_nav links with images

    Quote Originally Posted by barendfaber View Post
    Hi David,

    Thank you for the recommendation. Unfortunately when I added this, it broke the site. I loaded the home.jpg to my main images folder as well as my template images folder. Do you have any idea why this has not worked?
    Sorry, stupid me! There were 2, I chnaged the one and forgot to add the ' at the end, fixed it and now it is working. Thank you!

 

 

Similar Threads

  1. Edit TOP_NAV
    By dmagic in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 18 Aug 2011, 11:28 AM
  2. images links changing
    By Lackew in forum General Questions
    Replies: 5
    Last Post: 10 Mar 2010, 04:06 AM
  3. fading images with links
    By gsdcypher in forum General Questions
    Replies: 2
    Last Post: 29 Nov 2008, 02:47 AM
  4. changing text links to images
    By mustang in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 6 Dec 2007, 03:41 AM
  5. Replacing Links with Images
    By bfwdesigns in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 14 Sep 2006, 01:14 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