Help needed: problem setting a specific url - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Help needed: problem setting a specific url (/showthread.php?tid=61146) |
Help needed: problem setting a specific url - El Forum - 09-30-2014 [eluser]adelregh[/eluser] Hi there, I have a controller called "faculty" which has 7 functions one of which is called "profile" I also have one view that wraps all these functions in a sidebar Now when, for example, the profile is tapped it opens perfectly but I want to change the URL from: .../faculty/profile To: .../faculty/#/profile Where # is going to be variable Help needed: problem setting a specific url - El Forum - 10-01-2014 [eluser]InsiteFX[/eluser] ./application/config/routes.php Code: $route['faculty/(:any)'] = "faculty/$1/profile"; But this really depends on what you are really trying to do in your Controller. Help needed: problem setting a specific url - El Forum - 10-01-2014 [eluser]adelregh[/eluser] Thanks for your reply Here is my code: In the controller: Code: public function index() Eventually instead of SSN = "1", I wanna take the variable from the URL In the view I have something like this: Code: <div id="wrapper"> Help needed: problem setting a specific url - El Forum - 10-01-2014 [eluser]adelregh[/eluser] I got it working but I have one small issue. Please help When I click on a user's profile (sidebar taps) the URL will be: ..../profile/3 Now when I click on his experience the URL will change to: ..../experience Is there any way that I can keep the last segment so that the URL will be: ..../experience/3 I need the number to be there so that I can use $this->uri->segment(); Any suggestions would be greatly appreciated. Help needed: problem setting a specific url - El Forum - 10-02-2014 [eluser]CroNiX[/eluser] Just add the ID to where you are creating the link? Help needed: problem setting a specific url - El Forum - 10-02-2014 [eluser]adelregh[/eluser] The ID is not fixed it is a variable Help needed: problem setting a specific url - El Forum - 10-03-2014 [eluser]CroNiX[/eluser] Well, yes, but how are you generating your /profile/3 urls, where I assume the 3 is a variable? |