Skip to content

Instantly share code, notes, and snippets.

@tinchco
Last active Aug 29, 2015
Embed
What would you like to do?
$env_config['resource_router'] = array(
':any' => function($router, $wildcard1) {
// market
if ($wildcard1->isValidUrlTitle(array('channel_id' => '1'))) {
$router->setTemplate('market/index');
} else {
$router->set404();
}
},
':any/:any' => function($router, $wildcard1, $wildcard2) {
// market/theater
if ($wildcard2->isValidUrlTitle(array('channel_id' => '2'))) {
$router->setTemplate('theater/index');
// market/calendar
} elseif ($wildcard2->is('calendar')) {
$router->setTemplate('calendar/index');
// market/series
} elseif ($wildcard2->is('series')) {
$router->setTemplate('series/index');
// market/victory
} elseif ($wildcard2->is('victory')) {
$router->setTemplate('victory/index');
// market/page-entry
} elseif ($wildcard2->isValidUrlTitle(array('channel_id' => '8'))) {
$router->setTemplate('page/index');
} else {
$router->set404();
}
},
':any/:any/(info|menu|admission|directions)' => function($router, $wildcard1, $wildcard2, $wildcard3) {
$validTheater = $wildcard2->isValidUrlTitle(array('channel_id' => '2'));
// market/theater/theater-page
if ($validTheater) {
$router->setTemplate('theater/'.$wildcard3);
} else {
$router->set404();
}
},
':any/:any/(account|events|faq|history|rewards|terms)' => function($router, $wildcard1, $wildcard2, $wildcard3) {
$validVictory = ($wildcard2->is('victory'));
// market/victory/victory-page
if ($validVictory) {
$router->setTemplate('victory/'.$wildcard3);
} else {
$router->setTemplate('victory/index');
}
},
':any/:any/:any' => function($router, $wildcard1, $wildcard2, $wildcard3) {
// market/show/show-entry
if ($wildcard3->isValidUrlTitle(array('channel_id' => '5'))) {
$router->setTemplate('show/index');
// market/package/package-entry
} elseif ($wildcard3->isValidUrlTitle(array('channel_id' => '10'))) {
$router->setTemplate('package/index');
// market/theater/calendar
} elseif ($wildcard3->is('calendar')) {
$router->setTemplate('calendar/theater');
// market/theater/series-page
} elseif ($wildcard3->isValidUrlTitle(array('channel_id' => '3'))) {
$router->setTemplate('series/show');
} else {
$router->set404();
}
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment