Database And Routes

#3
[eluser]ShoeLace1291[/eluser]
|---Categories--| //Reviews, News, Tutorials, etc. When viewing the "news" category, url would be mysite.com/pages/news ---- function is called "category" and lists all subcategories that fall under this category.
|
|
SubCategories(subCategoryID, categoryID) //Under a category such as reviews: Xbox 360, PS3, etc... url would be mysite.com/pages/reviews/xbox-360 ---- function is called "subcategory" and lists all the pages under that subcategory.
|
|
Pages(pageID, subCategoryID) //News articles, xbox 360 reviews, etc... url would be mysite.com/pages/reviews/xbox-360/halo-3 ---- function is called "view" and would display the entire page.

Above is a tree I created that would explain how my tables and urls are linked. I currently do not have it set up correctly which is why i'm posting this. all of the above urls are contained in a controller called pages.

These page titles are all powered by databases, so I can't just make a route that reroutes pages/news to pages/category, but it would be pages/category that I would be routing to. This is my current routes config file:

Code:
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";

$route['register/activate/:any'] = 'register/activate';
$route['logout'] = 'main/logout';
/*$route['pages/news'] = 'pages/category';
$route['pages/news/:any'] = 'pages/subcategory';
$route['pages/reviews'] = "pages/category";
$route['pages/reviews/:any'] = "pages/subcategory";
$route['pages/tutorials'] = "pages/category";
$route['pages/tutorials/:any'] = "pages/subcategory";*/

$route['pages/:any'] = "pages/category";
$route['pages/:any/(:any)'] = "pages/subcategory'";

You can see how I had done it prior to using the pages/:any. I can't do it that way because everytime a new category is created, I would have to create a new route.

Hopefully I've explained my situation well enough for you to answer. Thanks for your time.


Messages In This Thread
Database And Routes - by El Forum - 01-06-2010, 05:40 AM
Database And Routes - by El Forum - 01-06-2010, 05:54 AM
Database And Routes - by El Forum - 01-07-2010, 04:19 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.