Closed akukral closed 8 years ago
Sorry, I figured it out.
I figured out how to filter the the url titles but how would I use the call back for check the channel_short_name if they are valid urls?
This should do it:
$config['resource_router'] = array(
':any' => function($router, $wildcard) {
// use real channel ids here
$single_pages_channel_id = 1;
$microsites_channel_id = 2;
$microsite_sub_pages_channel_id = 3;
$channels = array(
$single_pages_channel_id,
$microsites_channel_id,
$microsite_sub_pages_channel_id,
);
if ($wildcard->isValidUrlTitle(array('channel_id' => $channels))) {
if ($wildcard->getMeta('channel_id') == $single_pages_channel_id) {
$router->setTemplate('site/_single_page');
} elseif ($wildcard->getMeta('channel_id') == $microsites_channel_id) {
$router->setTemplate('site/_microsite');
} elseif ($wildcard->getMeta('channel_id') == $microsite_sub_pages_channel_id) {
$router->setTemplate('site/_microsite_sub_page');
}
} else {
$router->set404();
}
},
);
Wow, that worked great! Thank you for your help! It is greatly appreciated.
Is it possible and if so how would I route based on the channel short name of a wild card using the function? Basically using Resource Router to handle a landing page like this code: