Forums / Templates, Stylesheets, Page Layout / Changing top_nav links with images

Changing top_nav links with images

Started by barendfaber on 6 Aug 2012, 2:49 PM · Views: 948

Results 1 to 6 of 6
6 Aug 2012, 2:49 PM
#1
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

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.php?69805-Looking-to-replace-navmainwrapper-with-image-links-and-searchbar&highlight=replace+check+link+image) but it is a bit different from the top nav!

7 Aug 2012, 6:49 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Changing top_nav links with images

Looks like you have sorted this out

Zen-Venom Get Bitten

7 Aug 2012, 10:02 AM
#3
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

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?

7 Aug 2012, 10:44 AM
#4
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

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

define('TOP_MENU_HOME', 'Home');

with this

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

7 Aug 2012, 11:09 AM
#5
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

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?

7 Aug 2012, 11:12 AM
#6
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

Re: Changing top_nav links with images

barendfaber:

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!