![]() |
Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) (/showthread.php?tid=36746) |
Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - El Forum - 12-13-2010 [eluser]internut[/eluser] I've not been too active with CI lately but have done some great things with it. I'm trying a different approach. I'm looking to basically have a way to have from the default install of CI have the Welcome / Index controller + Another controller handle a lot of the front of the site. Reason for my madness is to have pages all created via DB records. In short: .com/ <--- Index Page (welcome.php CLASS) .com/any-folder/ <--- Routed to: (interior.php CLASS) .com/any-folder/sub-folder-name/ <--- Routed to : (interior.php CLASS) The input that comes from segment 1 & 2 (or 3 / 4 / 5 etc) call the DB and populate what interior.php will output via the data grabbed via model and used as output in the view. Basically allowing a very dynamic site based off DB records. Not creating a controller for every area of the site. .com/about-us/ (about-us.php controller) .com/contact-us/ (contact-us.php controller) .com/help/ (help.php controller). If I'm not clear let me know ![]() J Any thoughts? Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - El Forum - 12-13-2010 [eluser]internut[/eluser] Basically just want the string if not index to be returned and I can parse it from there if its not a URI Segment string. Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - El Forum - 12-13-2010 [eluser]tomcode[/eluser] Guess You mean this : 1. Your site's home is handled by controller welcome.php 2. the rest is handled by controller interior.php To achieve this change Your config/routes.php : Code: $route['default_controller'] = "welcome"; Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - El Forum - 12-14-2010 [eluser]internut[/eluser] Thanks Tomcode.. While that did work I wonder if I should go the _remap method. The route method does not seem to then let me have an /admin/ controller folder and be able to call that for an admin area. That basically behaves normally. Kind of want if a controller is named / available then use that. If not fall back to interior or welcome controller than handles the front end or is the default. Though if a controller is present use that. Am I asking to much of CI? Jason Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - El Forum - 12-14-2010 [eluser]tomcode[/eluser] This should do it ![]() Code: $route['default_controller'] = "welcome"; Not new but trying to figure out how to go about this (Controller + Route / Remap ? ) - El Forum - 12-14-2010 [eluser]internut[/eluser] You're a routing fool! and awesome! Thanks so much! I was thinking along those lines, cut couldn't put it together ![]() Again, thx! |