Zen Cart Logo
Forums / General Questions / Icons for links in Ezpages bar header

Icons for links in Ezpages bar header

Locked

Views: 5,011

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
10 Jul 2006, 4:38 AM
#1
strokerstees avatar

strokerstees

New Zenner

Join Date:
May 2006
Posts:
14
Plugin Contributions:
0

Icons for links in Ezpages bar header

Does anyone know how I might be able to add images in place of standard text links for a site that uses EZpages for navigation?

Here is a link to the site; http://www.yabbos.com

I've looked in tpl_ezpages_bar_header php and ezpages_bar_header.php files and am stumped. Not surprising considering my lack of php skills. I'm guessing I need to define images for each link but don't know how to go about it.

Has anyone done something similar?

Thanks,
Todd

10 Jul 2006, 7:16 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Icons for links in Ezpages bar header

They are built based on the name of the EZ-Page title, via includes/modules/YOURTEMPLATE/ezpages_bar_header.php

To convert them to images, you'll have to:

  • change the database to allow you to store the image name
  • change the module to retrieve the image name
  • change the module to use the image name when creating the link
  • deal with stylesheet matters to ensure the images display consistently as desired

... and this is assuming everything's only in one language.

.
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.

10 Jul 2006, 7:44 AM
#3
strokerstees avatar

strokerstees

New Zenner

Join Date:
May 2006
Posts:
14
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

English only. ;)

So it is workable then? The changes you list, are they extensive or just a few lines of added code?

If the changes are too daunting I will probably just style the header bar with the stylesheet, but would much prefer the images.

I'm guessing rollovers is asking a bit too much, eh? lol

Thanks,
Todd

10 Jul 2006, 12:20 PM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Icons for links in Ezpages bar header

There are a variety of ways of doing this depending upon exactly what you want to achieve. However, here's a relatively simple approach that sidesteps the need for database changes.

Create a tpl_ezpages_bar_header.php in your template and replace the for loop with the following> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {

$tab_img = strtr(strtolower($var_linksList[$i]['name']),' ','_') . '_tab.' . TAB_FILE_EXT; ?><a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo zen_image($template->get_template_dir($tab_img, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . $tab_img, $var_linksList[$i]['name']); ?></a>

<?php } // end FOR loop ?>The first line builds an image file name from the text that would have appeared on your tab. So the first one in your menu would be the_stuff_tab.gif if you have defined TAB_FILE_EXT to be 'gif'.

TAB_FILE_EXT is a new constant for which you would need to add a definition in your header.php file. Though I guess you could hard-code it here to avoid that step if you wished.

The second line replaces the EZ_Pages link text with an image with the name that was built in the first line, and uses the original link name as the Alt image.

You would then need to create your images and put them in your template/images file. If your images are all the same size, then it would be good to add the width and height as parameters 3 and 4 of the zen_image function.

Finally, some styling of the images/links may be necessary to persuade them to line up neatly across your page.

Rollovers? That could be could be achieved by including an onmouseover command as the 5th parameter of the zen_image function, with the rollover image name built up in the same way as was done for the initial tab image.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

10 Jul 2006, 6:52 PM
#5
pauls avatar

pauls

Zen Follower

Join Date:
Feb 2006
Location:
UK
Posts:
300
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

strokerstees:

Does anyone know how I might be able to add images in place of standard text links for a site that uses EZpages for navigation?

Has anyone done something similar?

Thanks,
Todd

Like this ? http://www.stylish-bathroom-cabinets.co.uk/

10 Jul 2006, 7:01 PM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Icons for links in Ezpages bar header

Hi Paul

I actually thought about your site when I first saw this question, but ... errr ... you used category tabs not EZ-Pages. Nevertheless, the underlying technique is very similar and you're right that Todd might find value in visiting the thread where this approach was refined.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

10 Jul 2006, 8:01 PM
#7
pauls avatar

pauls

Zen Follower

Join Date:
Feb 2006
Location:
UK
Posts:
300
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Hi Kuroi,
yep thought it was close, still don't know enough about ZC terminology, but I figured you and I thrashing it out on that other thread would be worth a read by Stokerstees :thumbsup:

11 Jul 2006, 12:35 AM
#8
strokerstees avatar

strokerstees

New Zenner

Join Date:
May 2006
Posts:
14
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Booyah!! We have success! Even a noob like me was able to figure it out after a while. (I had to hardcode the define into the tpl_ezpages_header thingy as I apparently put it in the wrong header file or that just didn't work.)

http://www.yabbos.com to check it out.

Now to add rollovers. I'll search the forum for adding onmouseover commands and just exactly how to difine the sizes as they are all the same size.

Thanks for the help once again Kuroi!

Todd

11 Jul 2006, 2:34 AM
#9
strokerstees avatar

strokerstees

New Zenner

Join Date:
May 2006
Posts:
14
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Hmmmm. Not finding the info I am looking for after two hours of searching. I may have found it, but simply didn't understand it?

I looked at Easy Rollovers but that only seems to work with zen buttons, which these are not.

Any suggestions?

Thanks,
Todd

14 Jul 2006, 8:21 AM
#10
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Icons for links in Ezpages bar header

I'd recommend that you first get your head round javascript rollovers, to which there's a helpful introduction here.

Then work out what inline javascript would need to appear in the HTML that Zen Cart produces.

Finally insert that inline javascriot into the 5th parameter of the zen_image function call.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

18 Aug 2006, 9:16 AM
#11
rvagrrl avatar

rvagrrl

New Zenner

Join Date:
Oct 2005
Posts:
90
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

kuroi:

Create a tpl_ezpages_bar_header.php in your template and replace the for loop with the followingThe first line builds an image file name from the text that would have appeared on your tab. So the first one in your menu would be the_stuff_tab.gif if you have defined TAB_FILE_EXT to be 'gif'.

TAB_FILE_EXT is a new constant for which you would need to add a definition in your header.php file. Though I guess you could hard-code it here to avoid that step if you wished.

The second line replaces the EZ_Pages link text with an image with the name that was built in the first line, and uses the original link name as the Alt image.

You would then need to create your images and put them in your template/images file. If your images are all the same size, then it would be good to add the width and height as parameters 3 and 4 of the zen_image function.

Hey there! I'm trying to do the same thing for one of my sites, but with the EZ-Pages footer. I think my problem is that I'm not sure where to set the defines for TAB_FILE_EXT for the footer as opposed to the header. The alternative seems to be to hardcode it in, but I'm not confident enough in my shaky coding. =) Any ideas?

Thanks!!

18 Aug 2006, 9:23 AM
#12
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Icons for links in Ezpages bar header

Hardcoding it in would mean no more than making the code read like this> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {

$tab_img = strtr(strtolower($var_linksList[$i]['name']),' ','_') . '_tab.gif'; ?><a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo zen_image($template->get_template_dir($tab_img, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . $tab_img, $var_linksList[$i]['name']); ?></a>
<?php } // end FOR loop ?>or jpg if you prefer.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

18 Aug 2006, 9:47 PM
#13
rvagrrl avatar

rvagrrl

New Zenner

Join Date:
Oct 2005
Posts:
90
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Thanks so much, it worked like a charm!

Leila

27 Aug 2006, 2:29 PM
#14
hennie avatar

hennie

New Zenner

Join Date:
Jan 2005
Posts:
18
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Please help. I've done the following as suggested. Copy an image into the template/images folder with the name Bargain Section.jpg and rename it to Bargain_Section_tab.jpg. The placemarks for the pictures appear but the picture does not show up. Can anyone please give me some suggestions of what wrong.

27 Aug 2006, 2:35 PM
#15
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Icons for links in Ezpages bar header

Very difficult to tell without seeing the site, but my best guess would be that you need to rename your image file entirely in lower case, i.e. bargain_section_tab.jpg

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

27 Aug 2006, 2:46 PM
#16
hennie avatar

hennie

New Zenner

Join Date:
Jan 2005
Posts:
18
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

kuroi:

Very difficult to tell without seeing the site, but my best guess would be that you need to rename your image file entirely in lower case, i.e. bargain_section_tab.jpg

Well Kuroi what can i say, looks like your best guess did the trick. Thank you very much for the help. Always the small things that I dont think about.

Cheers
Hennie

11 Jul 2008, 1:08 AM
#17
west_one avatar

west_one

New Zenner

Join Date:
Nov 2006
Posts:
34
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Hi
I need some help with this as I am not getting a image showing?

her is my code in zencart/includes/templates/classic/templates/tpl_ezpages_bar_header.php

<?php
/**
 * Page Template
 *
 * Displays EZ-Pages Header-Bar content.<br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_ezpages_bar_header.php 3377 2006-04-05 04:43:11Z ajeh $
 */

  /**
   * require code to show EZ-Pages list
   */
  include(DIR_WS_MODULES . zen_get_module_directory('ezpages_bar_header.php'));
?>
<?php if (sizeof($var_linksList) >= 1) { ?>
<div>
<?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {

$tab_img = strtr(strtolower($var_linksList[$i]['name']),' ','_') . '_tab.gif'; ?><a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo zen_image($template->get_template_dir($tab_img, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . $tab_img, $var_linksList[$i]['name']); ?></a>

<?php } // end FOR loop ?>
</div>
<?php } ?>
```and I have added the image :
products_new_tab.gif

and the EZ-Pages > Page Title is :
Products New

Simon

Zen Version: **v1.3.8a, **cPanel Version: 11.16.0-RELEASE, Apache version: 2.0.61, PHP version: 5.2.4, MySQL version: 5.0.27-standard, Operating system: Linux

11 Jul 2008, 5:05 AM
#18
hennie avatar

hennie

New Zenner

Join Date:
Jan 2005
Posts:
18
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Have you tried to copy that same file to template_default/templates?

11 Jul 2008, 9:33 AM
#19
west_one avatar

west_one

New Zenner

Join Date:
Nov 2006
Posts:
34
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

hennie:

Have you tried to copy that same file to template_default/templates?

Hi

tried that still not working?

simon

Zen Version: **v1.3.8a, **cPanel Version: 11.16.0-RELEASE, Apache version: 2.0.61, PHP version: 5.2.4, MySQL version: 5.0.27-standard, Operating system: Linux

15 Jul 2009, 3:29 AM
#20
radish avatar

radish

New Zenner

Join Date:
Jan 2006
Posts:
67
Plugin Contributions:
0

Re: Icons for links in Ezpages bar header

Hi,

Does anyone know if there are any changes in v1.38 that would prevent Kuroi's solution in this thread from working properly?

It seems like a fairly simple solution; however I can't get the images to display on my site.

Cheers,
C