Okay, well you could either put code like this into each td cell like
this:
<td class="navtext" <?php if (sect == 5) print "id=\"sel\""; ?>>
That is kind of ugly, however. A more elegant solution would be to make
an array containing the links then do a loop kind of like this (I'm just
typing the code off the top of my head, so there is likely to be some
errors):
$menuItems = array('Home', 'Introduction', 'Changes & Cuts',
'Scores', 'Orchestra', 'Synthesizers', 'Sound System', 'Articles');
$i = 0;
foreach ($menuItems as $item) {
if($sect == $i) {
print "<tr><td class=\"navtext\" id=\"sel\"><a
href=\"\">$item</a></td></tr>\n";
} else {
print "<tr><td class=\"navtext\"><a
href=\"\">$item</a></td></tr>\n";
}
$i++;
}
The obvious problem with my solution is the links will also presumably
have to be entered into an array, and I don't think the foreach
construct can work on two arrays simultaneously, but you can use the $i
variable as the index to your second array.
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Martin Hughes) wrote:
> OK here's the code in the page:
>
> <!-- Start Navigation -->
> <div id="navbar">
> <table class="navtable" width="160" cellpadding="4">
> <!-- Navigation Bar Heading -->
> <tr>
> <td class="navhead">Welcome</td>
> </tr>
> <tr><td class="navtext" id="sel"><a href="">Home</a></td></tr>
> <tr><td class="navtext"><a href="">Introduction</a></td></tr>
> <tr><td class="navtext"><a href="">Changes & Cuts</a></td></tr>
> <tr><td class="navtext"><a href="">Scores</a></td></tr>
> <tr><td class="navtext"><a href="">Orchestra</a></td></tr>
> <tr><td class="navtext"><a href="">Synthesizers</a></td></tr>
> <tr><td class="navtext"><a href="">Sound System</a></td></tr>
> <tr><td class="navtext"><a href="">Articles</a></td></tr>
> <tr><td class="navtext"><a href="">21st Century Les
> Misérables</a></td></tr>
> <tr><td class="navtext"><a href="">Information</a></td></tr>
> <tr><td class="navtext"><a href="">Discussion Forums</a></td></tr>
>
> </table>
> </div>
> <!-- End Navigation -->
>
>
> I am using this 1 page as the php 'template' with content added depending on
> the url. For example, to go to the synthesizers page the url is:
> index.php?sect=5&id=0&page=31
>
> where sect=5 is the part that sets the menu highlight (the menu is alway the
> same, hard-coded into the page - all I want to do is change the css id="sel"
> from Home to Synthesizers.
>
> Cheers
>
> Martin
>
>
--
__________________________________
Gabe da Silveira, Web Designer
Twin Cities Student Unions
University of Minnesota
http://www.coffman.umn.edu
wFone: (612)624-7270
eMail: [EMAIL PROTECTED]
hPage: http://www.visi.com/~jiblet
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]