[thelist] php question revisited

Kasimir K evolt at kasimir-k.fi
Tue Jun 28 14:56:05 CDT 2005


Tom Dell'Aringa scribeva in 2005-06-28 19:25:
> My most recent post may have been too detailed so here is the problem simplified. 

Actually you oversimplified and lost the problem :-) It's not in the 
comparision, but the string:


Tom Dell'Aringa scribeva in 2005-06-27 19:57:
> $thelist .= "\t<li
> 
>   if ($current == $category->nicename) { id=\"current\"; }
> 
> 
> >$link\n";

An if-block isn't really a string :-) You need to use ternary operator:

$thelist .= "\t<li"
    . ($current == $category->nicename ? " id=\"current\"" : "")
    . ">$link\n";

.k


More information about the thelist mailing list