Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ez: How do I add the 'ALT' text to my echoed image in my script?


Propaganda

Recommended Posts

Posted

hi

 

My goal is to make a quick little script to pull a random product image out of the database and display it my special header banner...

 

It does work, mostly, and I added a special STS tag for it.

 

It is missing the ALT text for the image. I would like the ALT text to be the product name.

 

Can someone please help me modify the code to echo out the ALT text for the images.

 

<?php
/*

This is the code for the $random_product_image$ STS tag.

*/


 $random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);

  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], 100, 100) . '</a>';



?>

 

thx

Posted
tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], 100, 100)

The code I put in RED IS the alt text.

 

Not sure why it isn't working for you.

 

And don't ask me for any more help.

 

NOT because I don't WANT to help - You have STS on the site and I know ZILCH about it is the only reason.

 

If you can't figure it out you should post in the support thread for the version of STS you have.

 

Most posts about STS receive little support if not posted in the proper place.

 

Good, bad or indifferent - I'm just telling you like it is.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

I did not realize STS would effect it really, but I will turn it off and try it out. After so, if it works w/out STS I will find the STS post.

 

Thanks for the confirmation that the code is correct.

Posted

I think I see the problem:

 

<?php
/*

This is the code for the $random_product_image$ STS tag.

*/


 $random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);

 $random_product['products_name'] = tep_get_products_name($random_product['products_id']);

  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], 100, 100) . '</a>';



?>

 

Try that.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Archived

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

×
×
  • Create New...