Re: Extracting Variables From URL
| From: | Zoltán Németh | Date: | Thu, 17 May 2007 07:07:20 +0000 |
| Subject: | Re: Extracting Variables From URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255045@lists.php.net to get a copy of this message | ||
I think you should try:
http://php.net/parse_url
greets
Zoltán Németh
2007. 05. 16, szerda keltezéssel 19.40-kor CK ezt írta:
> 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>
>