|
|
|
|
![]() ![]() |
| welbis |
Jan 13 2005, 03:50 PM
Post
#1
|
|
Guests |
if your website has sections in this form..
www.domain.com/?page="pagename" and you want it to show the same page at www.domain.com/"pagename" aswell... then this might help... i suggest you just take bits of it out and use them yourself, cos this is very specific to my site. It should be in the 404.php file. CODE ///////////////////////////////////////////////// ///////////////////////////////////////////////// ///////////////////////////////////////////////// $url = $_SERVER["REQUEST_URI"]; $url2 = substr($url, 1,1); if($url2 !== "?" && isset($url)) { $url = substr(strrchr($url, "."), 1, 4); //if the string appended to the domain doesnt end in php..check if its a user if($url !== "php") { ///////////////////////////////////////////////// ///////////////////////////////////////////////// $url = $_SERVER["REQUEST_URI"]; $url = substr($url, 1); $users = mysql_query("SELECT * FROM users WHERE username='$url' AND activated='1'"); $num = mysql_num_rows($users); if ($num) { while($user=mysql_fetch_array($users)) { /////////// //if the string is a user, then set the variables to that it parses the users page $page = "users"; $sectionarea = $page.' - '.$url; $a = "$url"; $val = 1; ///////// } } else { //get all the text after '?' $url2 = strstr($url, '?'); if($url2) { $url = strrchr(strrev($url), "?"); $url = substr($url, 1); $url = strrev($url); $sectionarea = (ucfirst($url)); } else { $sectionarea = (ucfirst($url)); } } ///////////////////////////////////////////////// ///////////////////////////////////////////////// } } if($url2 == "?" || empty($url)) { $sectionarea = $_GET['page']; if(!$sectionarea) { $sectionarea = Home; } else { $sectionarea = ucfirst($sectionarea); } } ///////////////////////////////////////////////// ///////////////////////////////////////////////// ///////////////////////////////////////////////// After this... include the content, and navigate through it to show certain content when the variable $sectionarea is equal to certain things. I.e. if it is Home... then display the home page, if it is News, then display the news blah blah |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th September 2008 - 05:40 AM |