Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Solution to use images for EZ-Pages links

Solution to use images for EZ-Pages links

Locked

Views: 4,933

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
29 May 2008, 2:24 AM
#1
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Solution to use images for EZ-Pages links

Adapted the link image code from Glenn Hebert's "Categories Dressing" mod to substitute the EZ Pages links text with an image if it is available. None of the other "Categories Dressing" features were adapted here, but they easily could be. I just didn't need them.

If you have an image, it should be named ezimg_yourEZpageNameHere.gif
where "yourEZpageNameHere" is substituted with the text that is in your EZ page link. If there are blanks in the name, replace the blanks with underscores when naming the image file. The image should exist in includes/templates/YOUR_TEMPLATE/images in order for the code to find it. If there is no appropriately named image found, the code will just put the text name that you defined just as the vanilla code does.

Here's my override copy of the includes/templates/YOUR_TEMPLATE/sideboxes/tpl_ezpages.php file with the changes applied to 1.3.8a version.

 
<?php
/**
* Side Box Template
* 05/28/08 Modifications adapted from Categories Dressing mod to post images instead of the
* page name if the *.gif image is available. 
*
* @package templateSystem
* @copyright Copyright 2003-2005 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.php 2982 2006-02-07 07:56:41Z birdbrain $
*/
 
$content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content .= "\n" . '<ul style="margin: 0; padding: 0; list-style-type: none;">' . "\n";
for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { 
$ez_name_display = $var_linksList[$i]['name'];
$assoc_image_file = 'ezimg_' . strtr($ez_name_display,' ','_') . '.gif'; /* replace blanks in name with underscore */
if( file_exists(DIR_WS_TEMPLATE_IMAGES . $assoc_image_file) ) {
/* code has determined that image file with appropriate name exists, so plug it in */
$ez_name_display = zen_image(DIR_WS_TEMPLATE_IMAGES . $assoc_image_file, '', '', '', ' title="Follow link to ' . $ez_name_display . ' "');
}
$content .= '<li><a href="' . $var_linksList[$i]['link'] . '">' . $ez_name_display . '</a></li>' . "\n" ;
} // end FOR loop
$content .= '</ul>' . "\n";
$content .= '</div>';
?> 
```
Hope this is helpful to someone!
Karen
29 May 2008, 5:33 AM
#2
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Solution to use images for EZ-Pages links

Not tested your creation, but thanks for sharing
:clap:

17 Sep 2008, 7:13 PM
#3
xt0rt avatar

xt0rt

Zen Follower

Join Date:
Sep 2005
Location:
The Internets
Posts:
179
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

Very useful indeed!

It's the little modifications like this that make Zen as great as it is.

17 Sep 2008, 7:26 PM
#4
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,799
Plugin Contributions:
15

Re: Solution to use images for EZ-Pages links

Pack it up and submit the mod.

:thumbsup:

27 Mar 2009, 7:14 PM
#5
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

anyone used this, or have something different?

i have copied the code, and named/uploaded my images appropriately (from the best i can tell)... with no success...

anyone?

site is https://www.customk9design.com/catalogzen

have placed image for the "About_Us" ezpage.

27 Mar 2009, 10:11 PM
#6
tracey avatar

tracey

New Zenner

Join Date:
Jan 2008
Location:
Switzerland
Posts:
38
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

I also tried this but it didn't work. Not sure why, the image just won't show up. Have been searching the forum through and through but with no luck on an answer. If anyone out there has a solution to this problem that would be great :)

27 Mar 2009, 10:45 PM
#7
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

tracey:

I also tried this but it didn't work. Not sure why, the image just won't show up. Have been searching the forum through and through but with no luck on an answer. If anyone out there has a solution to this problem that would be great :)

i am successfully adding images with links in my footer... im sure it would be the same in the header...

i havent gotten back up to the header yet, so havent tried it myself. let me know if you want to give it a try, and we'll figure out some code... :)

27 Mar 2009, 11:23 PM
#8
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

ok, so i have a partial solution... (still working on the rest)
it is working successfully in the header...
in your tpl_header.php file (in your "your template"/common folder)

try these changes...
note the simple edition of the link, and image call, also deleted some of that line that the link replaced.

the current bar is still showing, thats the next part for me to figure out, what needs to be deleted...

<!--eof-header logo and navigation display--> <!--bof-optional categories tabs navigation display--> <?php require($template->get_template_dir('tpl_modules_categories_tabs.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_categories_tabs.php'); ?> <!--eof-optional categories tabs navigation display--> <!--bof-header ezpage links-->

<li><a href='http://customk9design.com/catalogzen/index.php?main_page=page&id=2'><img src="http://www.customk9design.com/catalogzen/includes/templates/darkness/images/about_us.gif" alt="About Us" /></a></li>

<?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?> <?php require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?> <?php } ?> <!--eof-header ezpage links--> </div> <?php } ?>
27 Mar 2009, 11:32 PM
#9
customk1 avatar

customk1

Zen Follower

Join Date:
Mar 2009
Location:
Cornelius, NC
Posts:
334
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

ok simple answer to the duplicated toolbar, just go to zen cart admin, config/ezpages settings/ezpages display bar header--- set to zero...

there is still a gap afterwards, but im sure thats just a br or div somewhere that can be easily taken out.

check out the results here:
https://www.customk9design.com/catalogzen

5 Oct 2009, 8:49 AM
#10
fierystorm avatar

fierystorm

New Zenner

Join Date:
Feb 2008
Posts:
26
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

Hello,

Great idea here!

I'm curious if we could get an example concerning the "ezimg_yourEZpageNameHere.gif" renaming. For instance, is this asking for link name, page title, etc.? I've tried it a couple of different ways without success so if anyone would share some enlightenment on this (as I am assuming this is also where others have run into problems) that would be awesome!

Great work!

5 Oct 2009, 1:04 PM
#11
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

Fierystorm, I'm sorry I don't have the time to go back and look at the specifics right now, but this was a direct adaptation from Glenn's "Categories Dressing" code, so you will find your best answers in his documentation and in the support thread for that mod. At the time, he suggested I create this thread to help it stand out on its own for users that might not use his mod, but all I did was a copy and modify of his code as I needed it for the EZ_pages. I haven't been following any of the ZC support threads recently, it's even possible that he has built this into the mod or might have plans for doing that when he updates it for the new version. I just have no idea, but that mod should be the master of information since this was just a knockoff modification for my own needs with the ezpages.

HTH Karen

6 Oct 2009, 1:04 AM
#12
fierystorm avatar

fierystorm

New Zenner

Join Date:
Feb 2008
Posts:
26
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

Hey Karen!

Thanks for your response!

Actually, I had talked to him about that and I had been planning on making my own when I came across your thread. I still couldn't get it to work but what customk1 suggested did work for the nav bars so I'm happy there. I am going to keep at it though and will post what I was looking for just in case anyone else runs into the problem.

Thanks again!! :D

29 Apr 2011, 10:00 PM
#13
weif avatar

weif

New Zenner

Join Date:
Mar 2010
Location:
Butte, MT
Posts:
83
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

fierystorm:

Hello,
I'm curious if we could get an example concerning the "ezimg_yourEZpageNameHere.gif" renaming. For instance, is this asking for link name, page title, etc.? I've tried it a couple of different ways without success so if anyone would share some enlightenment on this (as I am assuming this is also where others have run into problems) that would be awesome!

It's looking for the image to have the same name (sort of) as the title you gave the EZ-Page. So, if your EZ-Page title is "This cool link" then the image name needs to be "ezimg_This_cool_link.gif" - Note that spaces are replaced with underscores and it is case sensitive.

However, there's still another possible issue. The code uses:
DIR_WS_TEMPLATE_IMAGES
for the path to the directory where images are stored. However, that is not necessarily the full path to the image where php will look for the file when it checks to see if the file exists.
DIR_WS_TEMPLATE_IMAGES
may need to be:
$_SERVER['DOCUMENT_ROOT'] . "/" . DIR_WS_TEMPLATE_IMAGES
in order for php to find the files...

16 May 2011, 9:08 PM
#14
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Solution to use images for EZ-Pages links

At first glance, I think this entire discussion has been rendered moot by one of Glenn's new mods: EZPages Improved Menus
His support thread is here: http://www.zen-cart.com/forum/showthread.php?t=171009

Thanks as always, Glenn, you're the best!!

17 May 2011, 12:16 AM
#15
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Solution to use images for EZ-Pages links

DIR_WS_TEMPLATE_IMAGES
may need to be:
$_SERVER['DOCUMENT_ROOT'] . "/" . DIR_WS_TEMPLATE_IMAGES
in order for php to find the files...Since html_header.php has

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />

any unqualified location is automatically prefixed with the rest of the correct path. That is why you can specify an image in your /images/ folder as simply images/yourimage.jpg without having to give the full http:// path.

I don't think I ever actually saw this thread before, but Ezpages Improved Menus and Ezpages Footer Columns do supersede the code here. I have improved it since the version this is based on, too, to allow full multi-language support.