Forums / All Other Contributions/Addons / Image Titles Support Thread

Image Titles Support Thread

Views: 28,613

Results 21 to 40 of 156
7 May 2008, 3:37 PM
#21
gjh42 avatar

gjh42

Black Belt

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

Image Titles Support Thread

The categories-tabs menu is not covered by this mod. If anything, an extension of the Categories Dressing code would be the thing to handle that.

If you are comfortable poking at PHP, you should be able to transfer the category image substitution code from tpl_categories.php. I'm afraid I don't have the time right now to work on it.

13 May 2008, 7:31 PM
#22
busymom avatar

busymom

New Zenner

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

Re: Image Titles Support Thread

Hi Glenn,
I just spent a little while changing all of my sidebox titles over to using this mod. Even though I had about 5 or 6 of them successfully coded the manual way, I decided to adopt this more generic approach to give me more flexibility and to make upgrading easier in the future. I hope that someone can convince the ZC folks to make this code part of the base code someday since it just allows for the images but doesn't require them!

Anyway, on to my question. I do have at least one sidebox title that I would like to be a link, but I'd prefer to have a hover image option so that it changes slightly to indicate that it's a link. Can you think of a clever way of accomodating this? I know the mouse cursor changes and I might have to settle for that, but I thought I'd throw out the question. I am using sliding door images in quite a few places elsewhere in my website, but they are all background images. This technique is a foreground image, so I don't think I can use that technique. Any suggestions or thoughts?

I suppose I could make it a background image with blank text for just this one sidebox image. I could probably come up with a way to do it in the css, but your solution is so much prettier!
Thanks, Karen (a fellow upstater for most of my life!)

13 May 2008, 11:28 PM
#23
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

Hello forum.. new user here.

So I've muddled my way through customizing my template (front page at least) and I'm down to two items. I've got Image Titles installed, and it works great, but I can't for the life of me figure out a filename for the "New Products" centerbox. I've tried "boxhead-whatsnew" and several variations. Does this mod not effect that box?

If it does not, that leads into my other question. I'd like to do the same thing to the NavCatTabs. I saw the comment somewhere that the closest bet was some extension of the "Categories Dressing" mod. I looked into it, but I'd like just a normal categories list, and special styling just for navcattabs. Any input on this?

This forum has been quite informative, many thanks in advance for any answers you might have.

14 May 2008, 3:45 AM
#24
busymom avatar

busymom

New Zenner

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

Re: Image Titles Support Thread

00Goat:

Hello forum.. new user here.

So I've muddled my way through customizing my template (front page at least) and I'm down to two items. I've got Image Titles installed, and it works great, but I can't for the life of me figure out a filename for the "New Products" centerbox. I've tried "boxhead-whatsnew" and several variations. Does this mod not effect that box?

If it does not, that leads into my other question. I'd like to do the same thing to the NavCatTabs. I saw the comment somewhere that the closest bet was some extension of the "Categories Dressing" mod. I looked into it, but I'd like just a normal categories list, and special styling just for navcattabs. Any input on this?

This forum has been quite informative, many thanks in advance for any answers you might have.

While I was hunting around for my own solutions today, I came across a tip from Glenn that will benefit you too. In your browser, use the View Source option (in FireFox it's called View Page Source) in the View dropdown. Look through the generated html until you find the box you're looking for and find the id='xxx' term where 'xxx' gives you the filename addon you're looking for.

HTH Karen

14 May 2008, 4:07 AM
#25
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

That's exactly what I did to get "whatsnew" as a filename to try, but it didn't work. I tried a couple variations of it, and a couple other names suggested by the surrounding code, but nothing would load an image.

14 May 2008, 5:03 AM
#26
gjh42 avatar

gjh42

Black Belt

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

Re: Image Titles Support Thread

Some things such as filenames and CSS tags are case sensitive. If you don't capitalize exactly as the original, it won't be identified as a match.

Try "boxhead-whatsNew" and see what happens.

14 May 2008, 5:34 AM
#27
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

I had that thought too :D I tried it again just to see if I was crazy, but that doesn't do it either.

While I've got your attention gjh, do you have any thoughts on the navcattabs question?

14 May 2008, 5:51 AM
#28
gjh42 avatar

gjh42

Black Belt

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

Re: Image Titles Support Thread

Definitely odd... I'll have to look at that when I wake up in the morning. The div id is "whatsNew".

If you just want image substitution for the cat tabs, the Image Titles code may be adaptable to do the job. It wouldn't be a straight cut & paste, but shouldn't be too complex to reference the category id being processed in each iteration.

14 May 2008, 3:57 PM
#29
gjh42 avatar

gjh42

Black Belt

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

Re: Image Titles Support Thread

(Re: post 22)
Karen,
I think you are on the right track with your last idea for the hover effect. If you have the foreground image sized and named correctly for the box, but actually just a transparent gif to hold the space, then you can use a background image to show the real title and its hover version.

14 May 2008, 4:09 PM
#30
gjh42 avatar

gjh42

Black Belt

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

Re: Image Titles Support Thread

00Goat,
I hadn't looked at the code for this in a while, so forgot that it is hard-coded. This centerbox requires its own file to be edited, so there is no point in a dynamic lookup for a box id. The code looks for centerboxhead-new.gif, so that is the name to use.

The readme does give this instruction:
"Name your header title images centerboxhead-featured.gif, centerboxhead-new.gif, and centerboxhead-specials.gif and save in /your_template/buttons/your_language/."
though the plaintext file is not the easiest format to read. Unfortunately, rendering text that is full of code examples into HTML is a long process and makes the original file very hard to read.

15 May 2008, 1:30 AM
#31
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

Very hard to read, especially word-wrapped, since I already looked for that. :lookarounThanks a lot for pointing it out. I wouldn't want to make it work as html either. Anyway, that worked for the center box.

I've been chewing on the cat tabs this evening. I used your instructions for product info display from the readme as a base. I located tpl_modules_categories_tabs.php using the developer toolkit, and armed with my virtually nonexistent knowledge of php attempted to make images happen. :laugh:

If you wouldn't mind my picking your brain I'd love to see if what I'm trying to do is even sane.

Thanks again

15 May 2008, 2:10 PM
#33
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

Well. after sleeping on it, I got it to work. I don't know that it's efficient or bulletproof, but it functions. It also could use a rollover, but that's a disaster I'm not sure I want to think about at the moment :blink:

So I located tpl_modules_categories_tabs by hunting the div in the dev toolkit. I split the output of $links_list[$i] into two variables:

$cathref - all of <a href blah>

$catname - just the text of the category name

I took your "prodname" example from the image titles readme as a base, and changed the expected filename to "cattab- . $catname". I kept your conditional intact and simply changed the output to wrap it in "$cathref" and "</a>"

Like i say, it works. It seems that there ought to be a better way to parse the URL though, that doesn't hang on hardcoded math like this. I also had the thought to lowercase the catname, but it wouldn't make the file completely case-insensitive, so I didn't bother.

<?php

/**

 * Module Template - categories_tabs

 *

 * Template stub used to display categories-tabs output

 *

 * @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_modules_categories_tabs.php 3395 2006-04-08 21:13:00Z ajeh $

 */



  include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORIES_TABS));

?>

<?php if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) { ?>

<div id="navCatTabsWrapper">

<div id="navCatTabs">

<ul>

<?php for ($i=0, $n=sizeof($links_list); $i<$n; $i++) { ?>

  <li><?php
	$catlink = $links_list[$i];
	$posgt = strpos($catlink, '>'); //position of greater than in html
	$posnlt = strpos($catlink, '<', $posgt); //position of less than after greater than
	$cathref = substr($catlink, 0, ($posgt + 1)); //href portion of link for rewrite
	$catname = substr($catlink, ($posgt + 1), -5); //cat name for image
	echo (file_exists(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/cattab-' . $catname . '.gif')) ? $cathref . zen_image(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/cattab-' . $catname . '.gif') . "</a>" : $links_list[$i];
?></li>

<?php } ?>

</ul>

</div>

</div>

<?php } ?>
15 May 2008, 5:59 PM
#34
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

Hrmm.... not bulletproof at all. Just got back to poking at it, and when one of them is clicked list_links outputs a span class, which completely throws off the code to separate the category name...

So the file check returns false and the selected button is replaced by the original text equivalent. Like I say, there has to be a better way of parsing that URL.

Additionally, since I posted earlier I've noticed that my $posnlt isn't being used. It was originally intended to help cut out the category name before I recalled that substr() takes start and length, not start and end.

One other thing I've been meaning to mention, I saw you comment in another thread that the directions here are misleading, and I would agree as I spent quite a bit of time trying to make things work along those lines. Where do we go to suggest that it be removed/modified?

15 May 2008, 6:00 PM
#35
gjh42 avatar

gjh42

Black Belt

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

Re: Image Titles Support Thread

Good for you! That looks effective, with one question: what happens if the cat name is two words with a space? I haven't gone back to the original code or to ZC functions to see exactly what string is involved or if this is addressed in the basic code.
Oh well, I guess some more work will be needed...

I agree it would be nice to get a more elegant method of splitting out the name.

15 May 2008, 6:12 PM
#36
gjh42 avatar

gjh42

Black Belt

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

Re: Image Titles Support Thread

The tutorial bit has been bugging me. I saw one of the devs (Kim or DrByte, can't remember which) mention that that one (written by a volunteer) had not been vetted closely enough and ought to be removed or replaced with the "redefine" instructions they gave, but I haven't been able to locate that post since then.

There is one flaw in the otherwise elegant method of defining the heading as an image, which is that some of the headings that are links have a " [more]" appended in the code which would not be replaced by the defined image. The [more] can be defined to blank, but can't cover different contents for different situations.

At any rate, any of the devs can do this.

15 May 2008, 9:56 PM
#37
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

Actually if the category name had a space it would return properly in this code, except the space would throw off the filename... that would be easy enough to strip out though. The bigger question is what to do with additional tags... I chose ">" as the search string because I hoped it would be unique. That span tag adds another, so the whole calculation goes off.

You'd think php would have a more direct way of saying "the word between the tags" to extract $catname, theoretically you'd have a reverse function then that could say "put $imagecode between the tags".... if only life were so easy :smile:

15 May 2008, 11:30 PM
#38
00goat avatar

00goat

New Zenner

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

Re: Image Titles Support Thread

Alright, back, with robustness. After some discussion with a friend, I settled on searching for '">' as the unique. I considered getting a total of '>' occurences and dividing by 2 to get the right one, but he pointed out that '>' in the catname would screw that up.

So, now we hunt '">' and '</' as the cutoffs:

$posgt gets the last occurrence of '">' using strrpos

$posnlt gets a new lease on life in order to calculate the length from the end for use with substr (eliminates that nasty hardcoded -5 that failed anyway in the presence of the span)

$catname is now subjected to trim() to eliminate that white space problem you mentioned.

The only remaining hardcoded number is the +2 to move $posgt past the '">' in question, and it's now part of the variable instead of being added in the substr.

And so it works... any other gaping holes?

<?php

/**

 * Module Template - categories_tabs

 *

 * Template stub used to display categories-tabs output

 *

 * @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_modules_categories_tabs.php 3395 2006-04-08 21:13:00Z ajeh $

 */



  include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORIES_TABS));

?>

<?php if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) { ?>

<div id="navCatTabsWrapper">

<div id="navCatTabs">

<ul>

<?php for ($i=0, $n=sizeof($links_list); $i<$n; $i++) { ?>

  <li><?php
	$catlink = $links_list[$i];
	$posgt = (strrpos($catlink, '">') + 2); //position of last greater than in html
	$posnlt = strpos($catlink, '</', $posgt); //position of less than after greater than
	$lenend = (strlen($catlink) - $posnlt);
	$cathref = substr($catlink, 0, $posgt); //href portion of link for rewrite
	$catname = trim(substr($catlink, $posgt, -($lenend))); //cat name for image
	echo (file_exists(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/cattab-' . $catname . '.gif')) ? $cathref . zen_image(DIR_WS_TEMPLATE . 'buttons/' . $_SESSION['language'] . '/cattab-' . $catname . '.gif') . "</a>" : $links_list[$i];
?></li>

<?php } ?>

</ul>

</div>

</div>

<?php } ?>
28 Jul 2008, 4:53 PM
#39
barleywine avatar

barleywine

New Zenner

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

Re: Image Titles Support Thread

Has anyone tried to get this mod to change the EZ pages on the top nav area to images? What would I name the image files to get it to see them?

Thanks!

17 Aug 2008, 12:27 PM
#40
jvanree avatar

jvanree

Zen Follower

Join Date:
Mar 2008
Location:
Gouda, Netherlands
Posts:
211
Plugin Contributions:
0

Re: Image Titles Support Thread

I read about this mod in the categories dressing support thread and I have a few questions.

  • Can this be used in combination with categories dressing?
  • Is version 1.1 or 1.2 recommended on zc 1.3.7. ?
  • How do you determin which size a text replacement image is supposed to be?

Thank you in advance!

Working on http://www.skull-shop.net once again.