john0611
08-05-2009, 07:10 AM
Hi all, I've been trying to work this one out?
<ul>
<?php /* current page */ $currentPage = basename($_SERVER['SCRIPT_NAME']); ?>
<li><a href="about_the_artist.php" <?php if ($currentPage == 'about_the_artist.php') {echo 'id="select"';} ?>>Introduction</a></li>
<li><a href="c._v._&_exhibitions.php" <?php if ($currentPage == 'c._v._&_exhibitions.php') {echo 'id="select"';} ?>>C.V. / Exhibitions</a></li>
<li><a href="#">Buy Prints</a></li>
</ul>
<h2>The Decades:</h2>
<?php
//echo linked results from db
// query db
$sql = mysql_query ("SELECT * FROM `decades` ORDER BY ID ASC");
// echo linked result from db
while ($row = mysql_fetch_assoc($sql)){
echo "<ul><li>" . "<a href='the_decades.php?ID={$row['ID']}'>" . ($row['Date']) . "</a></li></ul>";
// I'm not too sure here?
if ($currentPage == 'the_decades.php?ID={$row[ID]}') {echo 'id="select"';}
}
?>
What I would like to do is echo the linked results from the DB which works perfect, but when the user selects and clicks on the link I would like to have it highlighted to indicate current page. (id="select") is the a:hover from style sheet.
Any ideas would be great!
<ul>
<?php /* current page */ $currentPage = basename($_SERVER['SCRIPT_NAME']); ?>
<li><a href="about_the_artist.php" <?php if ($currentPage == 'about_the_artist.php') {echo 'id="select"';} ?>>Introduction</a></li>
<li><a href="c._v._&_exhibitions.php" <?php if ($currentPage == 'c._v._&_exhibitions.php') {echo 'id="select"';} ?>>C.V. / Exhibitions</a></li>
<li><a href="#">Buy Prints</a></li>
</ul>
<h2>The Decades:</h2>
<?php
//echo linked results from db
// query db
$sql = mysql_query ("SELECT * FROM `decades` ORDER BY ID ASC");
// echo linked result from db
while ($row = mysql_fetch_assoc($sql)){
echo "<ul><li>" . "<a href='the_decades.php?ID={$row['ID']}'>" . ($row['Date']) . "</a></li></ul>";
// I'm not too sure here?
if ($currentPage == 'the_decades.php?ID={$row[ID]}') {echo 'id="select"';}
}
?>
What I would like to do is echo the linked results from the DB which works perfect, but when the user selects and clicks on the link I would like to have it highlighted to indicate current page. (id="select") is the a:hover from style sheet.
Any ideas would be great!