Part of the EllisLab Network
   
 
Routing Issue
Posted: 16 May 2007 01:13 AM   [ Ignore ]  
Summer Student
Total Posts:  26
Joined  05-10-2006

Hey All,

Just wandering if it is possible to do the following with routes or CI in general.

i have a site which has a list of members and i would like the member home page to be located at:

http://www.mysite.com/mattems

i thought the way would be to add a route $route[’:any’] = ‘member’;

this will not work because it will not load any of my other controllers.

Any ideas of how i could get this to work without breaking the normal workings of CI.

Cheers

Matt

 Signature 
Profile
 
 
Posted: 16 May 2007 01:47 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1749
Joined  06-23-2006

Here’s a couple of options around that.

Use a pattern, such as:

http://www.mysite.com/-mattems-/

Then, you have a route, such as:

$route['-(.+)-'] = 'members/home/$1';

Or something like:

http://www.mysite.com/home-mattems/

Again, you have a pattern to match against.

Alternatively, you could create routes for each of your controllers, and then have a catch-all at the very end to route unrecognized uris (member names) to your desired controller/method. A bit more work, but that’ll ultimately depend on how big your site will be.

Also, look into the _remap function. It gets called instead of the method in your uri and lets you do some fancy routing in your controller.

 Signature 

Mac OS X 10.4.10, Apache 1.3.3, PHP 5.2.3, CodeIgniter 1.5.x., baby!

Profile
 
 
Posted: 17 May 2007 10:32 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  26
Joined  05-10-2006

Thanks alot for that i will take all of those options into account when we come to a solution. Thanks!!

 Signature 
Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120177 Total Logged-in Users: 59
Total Topics: 126306 Total Anonymous Users: 6
Total Replies: 664266 Total Guests: 496
Total Posts: 790572    
Members ( View Memberlist )