Short URL's

 
Post new topic   Reply to topic    Aprelium Forum Index -> Tutorials
View previous topic :: View next topic  

Did this help you?
Yes
0%
 0%  [ 0 ]
No
100%
 100%  [ 2 ]
Total Votes : 2

Author Message
Mikor
-


Joined: 21 Aug 2006
Posts: 144
Location: Hull, England

PostPosted: Mon Aug 21, 2006 12:27 am    Post subject: Short URL's Reply with quote

This script will make all your URL's into http://www.your-web-site.com/index.php?act=page_name

Just save this as index.php and put it in your htdocs folder.
Code:

/*
 *  To add a URL, put in this list: 'short name::relative path'
 *  Where 'short name' is the thing in the url (ie: index.php?act=page
 *  'relative path' can include directories (ie: pages/mypage.html)
 *  Make sure you put a comma between each entry in the list.
 */

$URLs = array('page1::page1.php','page2::page2.php'); //Put your pages here.

//Dont touch any of the below code.
$invalid = true;
$path = '';

foreach($URLs as $item){
     if($invalid == true){
          $exploded = explode('::',$item);
          if($_GET['act'] == $exploded[0]){
               $invalid = false;
               $path = $exploded[1];
          }
     }
}

if($invalid == true){
     die('Invalid URL.');
}else{
     include $path;
}


To link to a page, make a link to "index.php?act=page" where 'page' is the value you entered before the '::' in the list.

-----

Reply if you have any problems. I'm tired as i'm writing this, so it may be buggy.
Back to top View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Tutorials All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group