[support] Testing for arg() OR is_front

Earnie Boyd earnie at users.sourceforge.net
Mon Jul 12 12:17:38 UTC 2010


Chris McCreery wrote:
> Right now I have this:
>
> <?php if (arg(1) != '39'): ?>
> <div> Content </div>
> <?php endif; ?>
>
> This works just fine but when i try to add in a second arg(1) and OR
> statement it doesn't work. Any ideas?
>

I made this mistake often when I first started programming.  Use AND and 
not OR when using !=.  Or you could use the alternative method as show 
below.

<?php if (arg(1) != '39' && arg(1) != '49'): ?>
<div> Content </div>
<?php endif; ?>

ALTERNATIVE:

<?php if (!(arg(1) == '39' || arg(1) == '49')): ?>
<div> Content </div>
<?php endif; ?>

-- 
Earnie
-- http://progw.com
-- http://www.for-my-kids.com


More information about the support mailing list