Ok, I have a page that displays a bunch of cars. Some of the cars have been sold and some are still for sale. My client wants to show all the cars on one page. He wants the cars that are for sale to have an image overlayed on the thumbnail that shows for sale or sold.

I have built all of this with flexinode and all I have to do is edit and change the term from "for_sale" to "sold". Once I do that the image needs to change from For Sale to Sold. I hope I am being clear.

I have the thumbnail loading as a background and plan to load the overlay as a .png file on top as the actual image.

I figure it could be an if statement but not sure how to implement it.


   if($term=for_sale)
     echo("<img src='images/for_sale.png'>");
   else
     echo("<img src='images/sold.png'>");

   

but how do I phase it to get what the term is?

Any help would be appreciated.

Cheers,

Wes/

Comments

latte’s picture

Here is the link to the page I have.
http://www.foothillsmog.com/beta/?q=car_sales

With the code above it will display the For Sale image but the blue truck should say sold not for sale.

Cheers,

Wes/

nevets’s picture

What you want to know is if a particular term is set and for that you want to look at the taxonomy field of $node, so something like this would work

<?php
   $for_sale_tid = 1;  // Set this to the term id (tid) of the 'for_sale' term

   if( isset($node->taxonomy[$for_sale_tid]) )
     echo("<img src='images/for_sale.png'>");
   else
     echo("<img src='images/sold.png'>");

  
?>
latte’s picture

I love you!

That code worked perfect!

Have a look:
http://www.foothillsmog.com/beta/?time=1170540189

Thanks again!

Latte/