[thelist] best way to do dynamic tabs in PHP
Jackson Yee
jyee at vt.edu
Tue Jan 21 20:34:01 CST 2003
"Tom Dell'Aringa" <pixelmech at yahoo.com> wrote in message
news:20030122015741.4076.qmail at web12604.mail.yahoo.com...
> And I would do this for each of the six images. This seems like lots
> of code, and I'm thinking there is a better way to do this, but I'm
> not sure what it is. I do NOT want to do something like numbering my
> images instead of naming them and using an array, but I'm sure thats
> not the only way.
That's pretty much the same way that I do it as well, Tom, only I tend to
use a function along with descriptive names like "tabhome.png" and
"tabhomehighlight.png" nowadays.
<?php
function WriteTab($Link)
{
echo '<a href="/', $Link, '"><img="tab', $Link;
if ($_SERVER['REQUEST_URI'] == $Link)
{
echo 'highlight';
}
echo '.png" width..."
}
WriteTab("foo");
WriteTab("bar");
?>
Of course, I also use CSS tabs instead of images, but the general concept
is still there.
--
Regards,
Jackson Yee
jyee at vt.edu
More information about the thelist
mailing list