Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

class inside a php echo


Mighty Mike

Recommended Posts

Hi

 

How would i put a class inside a php echo statement :huh: i.e

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . $products_new['products_name'] . '</a>'; ?><br>

 

I am sure it is easy, but whatever i do it dont work :blink:

 

Thanks :thumbsup:

 

Mike

Link to comment
Share on other sites

You appear to be working with an array called products_new presumably populated from an SQL query. Assuming the code for this array is sound it should work. does the product name appear?

 

I'm not sure if the cPath info would make much difference here but you could try:

 

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $products_new['products_id']) . '">' . $products_new['products_name'] . '</a>'; ?><br>

Link to comment
Share on other sites

Hi Smmy

 

Thanks for your reply.

 

Sorry, i think i may have led you done the wrong path... lol

 

I should have mentioned it is a CSS style i am trying to put in... and i cant put it into the <td> tag as i have another php echo on the next line which i want to assign another class.

 

Thanks

Link to comment
Share on other sites

The mist clears,

 

No idea if this will work but have you tried:

 

 

'"><DIV class="someclass">' . $products_new['products_name'] . '</div></a>

 

My HTML sucks, just don't think it's worth the braincells trying to remember it so sorry if it's no use!

Link to comment
Share on other sites

The mist clears,

 

No idea if this will work but have you tried:

'"><DIV  class="someclass">' . $products_new['products_name'] . '</div></a>

 

My HTML sucks, just don't think it's worth the braincells trying to remember it so sorry if it's no use!

 

:thumbsup:

 

sweet, i always forget about those div's.

 

Thanks

 

Mike

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...