Well first of all you should note that [size=99px]=[/size] (single equals sign) is the ASSIGNMENT operator and [size=99px]==[/size] (double equals sign) is the COMPARISON operator.
So your code
[php]
if ($blocks = theme_blocks(“left”)) {
$output .= "
$blocks | n";
$output .= "
n";
[/php]
would be INCORRECT as a comparison operation. The condition (generally) would always be true because it evaluates that the assignment has happened successfully.
Also, because you broke up your code, it’s difficult to discern the actual construction of your IF statement.
Typically you will not go wrong with
if (conditional evaluation) {
Do this Code ;
} else {
Do this code instead;
}
I would like to note the use of the curly braces… Although they are not needed if the only statement to be executed (conditionally) is the very next statement (ONLY), however, I find that for ease of reading and for consistency, that I prefer to put them in there.
|