Welcome Guest, Not a member yet? Register   Sign In
Static routes vs. dynamic routes for a very simple project
#1

[eluser]Unknown[/eluser]
Admittedly I'm very new to CI. For whatever reason, I cannot figure out how to get my routes setup in a static way, since we aren't really doing anything dynamic with the URLs on this short-term web project.

It's a contest that will be short-lived; only 4 weeks in duration. We have URL structures already known to us, but I'm having trouble setting the routes array up correctly.

Example of structure:

Quote:/ (home)
/contest_not_started/ (landing page alerting user contest hasn\'t started)
/week_1/ (week one landing page)
/week_1/contest/ (week one contest form)
/week_2/ (week two landing page)
/week_2/contest/ (week two contest form)
/week_3/ (week three landing page)
/week_3/contest/ (week three contest form)
/week_4/ (week four landing page)
/week_4/contest/ (week four contest form)
/contest_ended/ (landing page alerting user contest has ended)

We have logic in place that already routes users automatically based on date ranges specific to the contest, so if a user hits the home (or any other page), they'll be properly redirected to the correct page, so now I need to figure out how to get the views to show up.

Code:
$route['week_1'] = 'week_1';
$route['week_1/contest'] = 'week_1_contest';

Right now, if I type "/week_1/contest", it redirects me to "/week_1", so clearly I'm misunderstanding something here. I would prefer that if someone types in "/week_2/contest" that they would be routed to the "week_1_contest.php" view that I have created (which is not currently the case).

I appreciate any help you can offer.




Theme © iAndrew 2016 - Forum software by © MyBB