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.
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)
Thanks for the info, Kuroi (and Glenn). I haven't been involved in coding enough recently to be thinking forward to optimization issues since losing all my brain cells during childbirthyears ago! I'm just doing enough to get by, creating my own site right now, so I definitely appreciate all the help I can get!
As I mentioned earlier, this code is actually the vanilla 1.3.8a code, not in the code I changed, so if the performance gain is worthwhile you might want to throw this into the 1.4 bucket of upgrades if that eventual version doesn't completely overhaul this code. I might make the change in my own code since I've already got the vanilla code overridden for my changes, just because every little bit helps!
Thanks again for your support, Glenn and Kuroi!