Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how do i add css class to this line of:php code?


janice171

Recommended Posts

Hi,

 

I want to add a class to this php:

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?>

 

 

i want to alter the button so it has a rollover state which i have configured in the style sheet so now i want to add the class.

 

Any help appreciated.

 

j

Link to comment
Share on other sites

I don't know if this will work or not, but it's worth a try:

 

tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'','','class="myclass"')

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 >

Link to comment
Share on other sites

Hi germ,

 

Thanks a lot.

That didn't quite do it but i messed around with the way it was written and it works when written like this:

tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART,' class="buttons-images" ')

 

I don't suppose you know where i can get rid of the surplus stuff in this same line of code such as:

border="0" width="104" height="20"

 

...this is the code within the <a></a> tags when i view the source but i don't know where it's being generated from.

 

Thanks again.

Link to comment
Share on other sites

My bad!!!

:blush:

 

I was looking at the osC functions, and I accidentally looked at:

 

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

Instead of:

 

  function tep_image_button($image, $alt = '', $parameters = '') {

The last one is the one you're using, and that's why the code you wrote works (and not what I wrote).

 

Unless you want to modify the osC HTML functions, I don't believe you can remove the "surplus stuff".

 

It's actually there to make the code compliant with HTML standards (I think).

 

The "surplus" isn't actually interfering with anything is it?

:unsure:

 

The easiest way to write it the way you want is to just skip PHP and do the code in HTML (IMHO).

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 >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...