http://www.php.net/reserved.variables use $_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI'] just parse its value to get what you needed. hth, John On 5/17/07, CK <ck@xxxxxxxxxxxxxxx> wrote:
Hi All, The following code works just fine for outputting links from an array. The next goal, is parsing the $thisPage variable from the URL (http://bushidodeep.com/contact.html/) so as <?php $thisPage=strtolower("contact");?>, this variable could also be assigned to the $links[] $key. Moving to a dynamic link generator class, what PHP function(s) could be used to parse the URL? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Generate Links</title> <?php $thisPage=strtolower("contact"); ?> </head> <body> <?php $links=array("Home","Work","Contact"); $count =0; echo "<ul id=\"navlist\"> \n"; foreach($links as $key){ if(strtolower($key)!= $thisPage){ echo ("<li><a href=\"./$key\" tabindex=\"$count;\" title=\"link to $key\">$key</a></li>\n"); $count ++; }else{ echo ("<li id=\"current\">$key</li>"); } } echo "</ul> \n"; /*prints key as tabindex...... $links=array("home","work","contact"); $count =0; echo "<ul id=\"navlist\"> \n"; foreach($links as $key){ echo ("<li><a href=\"./$key\" tabindex=\"$count;\" title=\"link to $key\">$key</a></li>\n"); $count ++; } echo "</ul> \n"; */ ?> <!--<a href="" tabindex="" title=""></a>--> </body> </html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- GMail Rocks!!!