Just jumping into Resource Router by Rob Sanchez and hit a wall already. I've forgone the category URL indicator as I believe it works without it. I'm attempting to achieve the following URL structure:
/posts/ -Display a list of ALL categories
/posts/category_url -Display a list of entries belonging to the category
/posts/category_url/entry_url -Display an entry that has the category
I currently have:
$env_config['resource_router'] = array(
'posts/:category/:any' => function($router, $wildcard_1, $wildcard_2) {
// is segment_3 a valid URL title?
if ($wildcard_2->isValidUrlTitle()) {
$router->setTemplate('templates/view');
} //is segment_2 a valid category URL title?
elseif ($wildcard_1->isValidCategoryUrlTitle()) {
$router->setTemplate('templates/cat_entries');
}
else { //We're at the root - show category list
$router->setTemplate('templates/cat_overview');
}
}
);
The Valid URL title portion works but stumped on what I require to get the other 2 working. Any insight gratefully accepted.