Proper Syntax/ How to Question?


#1

I need to know the proper syntax for allowing more then one section in this include.
This code below allows a “top” include only if this section loads.

<? if($section == "frontpage") { ?>

How would I add another section. I tried commas, quotes and a few other variations.

<? if($section == "frontpage, another section, more sections") { ?>

Whats the magic formula?
Thanks for the help


#2

From what I can tell, in words you want “If the section is A, B, or C then include”

So in PHP that would be…

<?php

if( $section == "frontpage" || $section == "another section" || $section == "more sections" ) {

...

}

?>

The double bar ("||") is a logical OR statement.


#3

That worked…thank you for the assistance. :D


#4

The Double Pipe || is a logical OR but you can also (depending on your needs) use the Double Ampersand && for a logical AND as well.