Sorry I am still very new. Hope you can enlighten and bear with me :
As I understand it both 1.1.8 and dburlmanager "dynamic/custom rule" means the ability to validate slugs against the db BEFORE going into the controller. As opposed to a normal static rules that uses the Controller to check the db like using loadModel() and then throwing out error if the article is not found.
Nowhere did I see how both implementation traverse the path and checks the db if the path is a valid one, like :
www.domain.com/cars/2011/toyota/camry/20cc/showmethecar.html ??
IS "show-me-the-car" page exist in "20cc"?
then check
IS "20cc" a valid entry in "camry" category?
then checks
IS "camry" a valid entry in "toyota" category?
then check
IS "toyota" a valid entry in "2011" category?
And throw out error at any point a category do not exist in any categories…
Creating rules like ‘/cars/<category>/<subcat1>/<subcat2>/<subcat3>/<subcat4>’ => ‘cars/list’,
means hard-coding the levels which might run 10 or more levels deep depending on how many categories the user creates…(its a CMS with unlimited number of nested categories)
and categories name (or its slugs) might have duplicates in separate folders like
www.domain.com/cars/2011/toyota/camry/20cc/showmethecar.html ??
www.domain.com/cars/2011/toyota/lexus/20cc/showmethecar.html ??
www.domain.com/cars/2011/honda/accord/20cc/showmethecar.html ??
So I need to check the validity of the full path.
Do you mean I should create hard-coded rules with as many as I "Guess" the level of subcategories will be? and create on subcat lesser on the next rule?
'/cars/<category>/<subcat1>/<subcat2>/<subcat3>/<subcat4><subcat5>/<subcat6>/<subcat7>/<subcat8>/<subcat9>/<subcat10> or more ..11?12?13?14?15?16?' => 'cars/list',
'/cars/<category>/<subcat1>/<subcat2>/<subcat3>/<subcat4><subcat5>/<subcat6>/<subcat7>/<subcat8>/<subcat9>' => 'cars/list',
'/cars/<category>/<subcat1>/<subcat2>/<subcat3>/<subcat4><subcat5>/<subcat6>/<subcat7>/<subcat8>' => 'cars/list',
etc
Or if using dburlmanager do I do this with as many levels I can think of?
<author:\w+>/<subcat1:\w+>/<subcat2:\w+>/<subcat3:\w+>/<post:\w+>'=>array(
'post/view',
'type'=>'db',
'fields'=>array(
'author'=>array(
'table'=>'tbl_author',
'field'=>'author_name'
),
'subcat1'=>array(
'table'=>'tbl_post_category',
'field'=>'post_cat_slug'
),
'subcat2'=>array(
'table'=>'tbl_post_category',
'field'=>'post_cat_slug'
),
'subcat3'=>array(
'table'=>'tbl_post_category',
'field'=>'post_cat_slug'
),
'post'=>array(
'table'=>'tbl_post',
'field'=>'post_slug'
),
),
),
<author:\w+>/<subcat1:\w+>/<subcat2:\w+>/<post:\w+>'=>array(
'post/view',
'type'=>'db',
'fields'=>array(
'author'=>array(
'table'=>'tbl_author',
'field'=>'author_name'
),
'subcat1'=>array(
'table'=>'tbl_post_category',
'field'=>'post_cat_slug'
),
'subcat2'=>array(
'table'=>'tbl_post_category',
'field'=>'post_cat_slug'
),
'post'=>array(
'table'=>'tbl_post',
'field'=>'post_slug'
),
),
),
<author:\w+>/<subcat1:\w+>/<post:\w+>'=>array(
'post/view',
'type'=>'db',
'fields'=>array(
'author'=>array(
'table'=>'tbl_author',
'field'=>'author_name'
),
'subcat1'=>array(
'table'=>'tbl_post_category',
'field'=>'post_cat_slug'
),
'post'=>array(
'table'=>'tbl_post',
'field'=>'post_slug'
),
),
),
if it is as simple as this, then I could have just pass in all the $_GET[subcat1], $_GET[subcat2], $_GET[subcat3],etc into the controller "car/list" and check if each subcat belongs to the one above it…
so I the only difference I see using dburlmanager or Y implementation is that these path traverse validations are done BEFORE going into the controller.
But I guess I can’t hard code the rules with any given amount subcats.
How to create ONE "dynamic rule" that accept any level of subcats, and then check against the db for the existence of subcatX within subcatY either through dburlmanager or Y custom rule?
I need help or samples to help me better understand these things…
Thank you