|
Posted by Rik on 06/14/06 14:18
alanbe wrote:
> Problem is that the first 9 work, that is I get the correct page
> linked.
> if (isset($_GET['page']) AND (array_search($_GET['page'],
> $allpages))) { $thispage=$_GET['page'];
> $title=array_search($thispage, $allpages);
> }
try:
if (isset($_GET['page']) && in_array($_GET['page'],$allpages)){
//code
}
array_search returns a key, not a boolean. Might work in a lot of cases, but
highly quircky here.
Like it states in the maual:
Warning:
This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function.
I would have reversed the array though:
'plan1' => 'The Plan' etc..
if(isset($_GET['page']) && array_key_exists($_GET['page'],$allpages)){
$thispage = $_GET['page'];
$title = $allpages[$_GET['page']];
}
Grtz,
--
Rik Wasmus
[Back to original message]
|