Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compleded routing setup from the database. [#100]
- Loading branch information
1 parent
0b78277
commit 702cf14
Showing
6 changed files
with
494 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
<?php | ||
/** | ||
* if there is no database file redirect any url to the installer.s | ||
*/ | ||
if (!file_exists(APP . 'config' . DS . 'database.php')) { | ||
Router::connect('/', array('plugin' => 'installer', 'controller' => 'install', 'action' => 'index')); | ||
} | ||
/** | ||
* redirect to the installer if there is nothing | ||
*/ | ||
if (!file_exists(APP . 'config' . DS . 'database.php')) { | ||
Router::connect('/', array('plugin' => 'installer', 'controller' => 'install', 'action' => 'index')); | ||
} | ||
|
||
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); | ||
$routes = Cache::read('routes', 'core'); | ||
|
||
/** | ||
* ...and connect the rest of 'Pages' controller's urls. | ||
*/ | ||
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); | ||
if (!$routes) { | ||
$routes = Classregistry::init('Management.Route')->getRoutes(); | ||
if (empty($routes)) { | ||
} | ||
} | ||
|
||
/** | ||
* management routes | ||
*/ | ||
Router::connect('/admin', array('plugin' => 'management', 'controller' => 'management', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true)); | ||
Router::connect('/admin/management', array('plugin' => 'management', 'controller' => 'management', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true)); | ||
foreach($routes as $route ){ | ||
//Router::connect($route['Route']['url'], $route['Route']['values'], $route['Route']['regex'] ); | ||
//Router::connect('/p/:year/:month/:day', array('plugin'=>'blog','controller'=>'posts','day'=>null,'admin'=>null), array('year'=>'[12][0-9]{3}','month'=>'0[1-9]|1[012]','day'=>'0[1-9]|[12][0-9]|3[01]') ); | ||
} | ||
$db = array( | ||
'url' => $routes[0]['Route']['url'], | ||
'values' => $routes[0]['Route']['values'], | ||
'regex' => $routes[0]['Route']['regex'] | ||
|
||
/** | ||
* blog routes | ||
*/ | ||
Router::connect('/admin/blog', array('plugin' => 'blog', 'controller' => 'posts', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true)); | ||
Router::connect('/blog', array('plugin' => 'blog', 'controller' => 'posts')); | ||
); | ||
|
||
/** | ||
* newsletter routes | ||
*/ | ||
Router::connect('/admin/newsletter', array('plugin' => 'newsletter', 'controller' => 'newsletters', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true)); | ||
Router::connect('/newsletter', array('plugin' => 'newsletter', 'controller' => 'newsletters')); | ||
|
||
/** | ||
* cms routes | ||
*/ | ||
Router::connect('/admin/cms', array('plugin' => 'cms', 'controller' => 'categories', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true)); | ||
// Router::connect('/admin/cms/:controller/:action/*', array( 'plugin' => 'cms', 'admin' => true ) ); | ||
Router::connect('/cms', array('plugin' => 'cms', 'controller' => 'contentFrontpages')); | ||
$code = array( | ||
'url' => '/p/:year/:month/:day', | ||
'values' => array('plugin'=>'blog','controller'=>'posts','day'=>null,'admin'=>null), | ||
'regex' => array('year'=>'[12][0-9]{3}','month'=>'0[1-9]|1[012]','day'=>'0[1-9]|[12][0-9]|3[01]') | ||
); | ||
|
||
var_dump( $db ); | ||
echo '<br/>'; | ||
var_dump( $code ); | ||
exit; | ||
?> |
Oops, something went wrong.