Skip to content

Instantly share code, notes, and snippets.

@mgirouard
Created October 17, 2010 03:51
Show Gist options
  • Save mgirouard/630520 to your computer and use it in GitHub Desktop.
Save mgirouard/630520 to your computer and use it in GitHub Desktop.
How to enable 'admin_' prefixed routes in Lithium
<?php
/* ----- snip (omitting everything already in config/bootstrap/action.php) ----- */
/**
* Filter to capture any admin-specific requests
* This simply updates the internal action name for dispatching purposes. In order for this to
* properly work across the board, you'll need to enable a persistent param for `admin` in your
* routes configuration. Something to the effect of the following will do nicely:
*
* {{{
* Router::connect(
* '/admin/{:controller}/{:action}/{:args}',
* array('admin' => true),
* array('persist' => array('admin', 'controller'))
* );
* }}}
*/
Dispatcher::config(array(
'rules' => array('admin' => array('action' => 'admin_{:action}'))
));
<?php
/* ----- snip (omitting everything already in config/routes.php) ----- */
/**
* Admin Routes
*/
Router::connect(
'/admin/{:controller}/{:action}/{:args}',
array('admin' => true),
array('persist' => array('admin', 'controller'))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment