...

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



moss2076
01-29-2010, 09: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") { ?>
<div><div><div>
<?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
Quote:
Parse error: syntax error, unexpected ',' in....
-


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


Many thanks

Tom

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



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


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

Describe the logic on how it "should work".



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum