I am trying to add a class to the body tag when php finds a certain word within a bit of html code.
So far I have come up with:
<?php echo $this->row->description;
if (stripos($this->row->description, 'Sold')!== false) {
echo 'true';
}
?>
I can see the 'true' being echoed on the web page. So I know it's working and it doesn't show if the word 'sold' is not on the web page.
What I want to do is change echo 'true'; to something that adds the class 'true' to the body tag of the web page.
$append_to_body = 'true';
, then in your body tag addclass="<?php echo $append_to_body?>"