Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add alt-tags to all images...


GD

Recommended Posts

Hello all,

 

I would greatly appreciate your help :!:

 

I want to add alt-tags to all the images used for the catalog, as well as, images I will be adding later-on. The reason "for-the-need" of these alt-tags, at least for me, is that, when someone hovers-over them, for example, a pixel.gif, the alt-tag is shown as an empty-tag. And I think this looks really bad. :shock:

 

I'm using a "heavily-modified" snapshot from 7/8/2002, that is updated with the latest CVS changes.

 

Thanks, GD :D

Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet!

Link to comment
Share on other sites

I seem to remember you can just specify the ALT tag in the tep_image() function... believe it's build in allready.. Can't check right now but try to write

, 'My ALT Tag'

 

before the closing ( ) ) bracket in the tep_image() function...

99% sure that will work perfectly.

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

as well as, images I will be adding later-on.

 

For that you could specify a default value in the actual function,

look at the tep_image() func in html_output.php.

 

M

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Thanks Mattice,

 

I took a look at the catalog/includes/functions/html_output.php on line 66:

 

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '')

 

I see the formatting: image source, alt text, ect. I guess I should leave this as-is, and just add my alt-tag information to the page code. :huh:

 

-----------------------------------------

 

EXAMPLE:

 

Location: catalog/includes/languages/english.php

 

define('BUTTON_IN_CART', 'Add to Cart');<-- Is this the alt-tag information for this image

 

Or should I also add the code below :?:

 

// in_cart.gif image alt-tag text

define('BUTTON_IN_CART_IMAGE_ALT', 'Add to Cart');

 

// in_cart.gif image width and height in pixels

define('BUTTON_IN_CART_IMAGE_IMAGE_WIDTH', '151');

define('BUTTON_IN_CART_IMAGE_HEIGHT', '14');

 

-----------------------------------------

 

Then add to the code of each page, where needed...

 

<?php echo tep_image(DIR_WS_IMAGES . 'button_in_cart.gif', 'BUTTON_IN_CART_IMAGE_ALT', 'BUTTON_IN_CART_IMAGE_IMAGE_WIDTH', 'BUTTON_IN_CART_IMAGE_HEIGHT'); ?>

 

I know this is very time-consumming, I'm hand-coding everything anyway, I just want to know if I'm heading the right-direction, as I'm pretty-new to PHP? :!:

 

I hope I'm making myself clear. :oops:

I want each image, except for pixel.gif of course to show it's own alt-tag information when someone hovers-over them.

 

I'll just add a define('IMAGE_PIXEL_TRANS', ''); AND define('IMAGE_PIXEL_BLACK', ''); to the catalog/includes/languages/english.php, so these image will not show any alt-tag.

 

Thanks again, GD :D

Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet!

Link to comment
Share on other sites

  • 4 weeks later...

-- Self Closed --

 

For...

 

1. Lack of my own knowledge of osC and (.php) code.

2. Lack of interest from knowledgeable people.

 

I guess, I'll stick with the generic look.

 

-- Self Closed --

Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...