View Full Version : Need to alter a small piece of code to check for Categories in Joomla

01-29-2010, 10:12 PM
Hello I have a piece of code in my frontpage/default_item.php file which enables the category called 'Movies' to be given extra divs for CSS rounded corners.

The code works fine and is as follows -

<?php if($this->item->category == "Movies") { ?>
<?php } ?>

I would now like to add a second category to use rounded corners as well. The category will be called "Football".

What do I need to add so the code to checks for more than one category e.g. both "Movies" & "Football"? I tried changing the code to the code below, but I get an error message
Parse error: syntax error, unexpected ',' in....

<?php if($this->item->category == "Movies", "Football") { ?>
<?php } ?>

Many thanks


01-29-2010, 10:28 PM
This is an "OR" condition ... one or the other.

<?php if($this->item->category == "Movies" || $this->item->category == "Football") { ?>
<?php } ?>

It couldn't be "AND" because it could never be both at the same time.

Describe the logic on how it "should work".