Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: for each question

Just compute the computable stuff beforehand and it becomes a lot more maintainable/readable.

// setup the basic data

$uri=option("uri").$rw["page"];

$class="";

// compute the computable data

if ($rw['is']) { $class="current" }

// write the line

echo "<li><a class='$current' href='$uri'>".$rw['item']."</a>"

Note that I’ve used class rather than id for semantic purposes – the ID of an element shouldn’t change, but it’s class can change and can be multiple, so you could even do:

$class="item";

if ($rw['is']) { $class .=" current" }

Skip to toolbar