Anyone know which piece of code controls how the links are listed? I want to change it from this:
HEADING
link link link etc.
To this:
HEADING
link
link
link
Thanks.
Anyone know which piece of code controls how the links are listed? I want to change it from this:
HEADING
link link link etc.
To this:
HEADING
link
link
link
Thanks.
This is controlled by the display: block; or display: list-item; properties in your stylesheet. Cat Dressing by default does this, so you must have deleted some code lines or otherwise are not applying Cat Dressing as designed.
Glenn, I adapted your Categories Dressing code for using an image for each of my EZPages link if one is available. I didn't make it very robust, just put the code in that I wanted. You made it so easy for me to use images for sidebox titles using the Image Titles mod that I decided to apply the same concept to my EZPages links. In case you ever choose to expand your Categories Dressing mod to include the EZ Pages sidebox, here's the code from my tpl_ezpages.php (it's the full code from 1.3.8a):
Hope this is helpful, KarenPHP Code:
<?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. Also defines CSS id "ezLink" concatenated
* with the same name as the EZ Link with blanks converted to underscores for the anchor tag
*
* @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>';
?>
Good work! Thanks for posting this so others can use it.
At a glance, it looks pretty complete to me. "Robust" doesn't mean having a lot of different features, just making the included features work in all circumstances.
Last edited by gjh42; 28 May 2008 at 09:12 PM.
It might be a good idea to post this in a new thread titled something like "Images for EZ-Page Links" so it will be easier for people to find.
I don't actually know how to move a post! I also just realized that the code I posted doesn't have the CSS tag code in it, even though the header comments says it does. I'll have to edit that part of the comments out before I re-post. I did have the code in there but decided to pull it out - there are already so many different ways of changing the css for the ezpages sidebox that I decided it was overkill.
I'll dup the post at your suggestion.
Karen
Didn't know appropriate place to post it, but I followed your advice, Glenn, and posted it here:
http://www.zen-cart.com/forum/showthread.php?t=98946
Thanks for giving me the code in both mods to make my work so much easier!! Karen
I just noticed a typo in one line:The closing ) is misplaced.PHP Code:
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
PHP Code:
$content .= '<div id="' . str_replace('_', '-', $box_id) . 'Content" class="sideBoxContent">';
Ironically, Glenn, I didn't change this code, it is still original from 1.3.8a. At first glance, I'd have to agree that it looks like a bug in the original code, though not one that I injected. Since I'm doing my development on my laptop and I'm on my desktop right now, I don't have any of my code in front of me, although I am looking at a vanilla unzipped version of 1.3.8a and the apparent oops is in there.
... looking more carefully ...
Actually, the more I look at it, I don't think its a bug at all. If you look carefully, they are building the name of the div id, but they are replacing the underscores with dashes. The string 'Content' gets concatenated on to the $box_id as part of the name of the id (like sideBoxContent is the class name - notice the Content tacked onto the end of the name). If the code was changed the way you suggested, there would be an extra keyword 'Content' in the <div> declaration between the id and class attributes. I'm not sure if that would flag an error, but I'm pretty certain that 'Content' would be unrecognized.
Does that makes sense to you?
Karen
Actually either is fine and will generate the same result.
The str_replace function here is simply replacing underlines with hyphens and including the result in the DIV ID. Since the string Content doesn't have any hyphens, it's unchanged. Whether it's therefore included in the ID by the str_replace or added afterwards makes no difference, the end result.
Glenn's version is however, very slightly more efficient and would be the way that I would code it by default, since the code will execute a fraction of a millisecond quicker if the Content string is outside of the str_replace function as then it doesn't have to be checked to see if has any underscores.
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Bookmarks