Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created January 30, 2013 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phalcon/4677808 to your computer and use it in GitHub Desktop.
Save phalcon/4677808 to your computer and use it in GitHub Desktop.
<?php
$di = new Phalcon\DI();
$di['router'] = function(){
$router = new Phalcon\Mvc\Router(false);
$router->add('/', array(
'module' => "frontend",
'controller' => "index",
'action' => "index"
))->setName('front-index');
$router->add('/:controller', array(
'module' => "frontend",
'controller' => 1,
'action' => "index"
))->setName('front-controller');
$router->add('/:controller/:action/:params', array(
'module' => "frontend",
'controller' => 1,
'action' => 2,
'params' => 3
))->setName('front-full');
$router->add('/adminko', array(
'module' => "backend",
'controller' => "index",
'action' => "index"
))->setName('back-index');
$router->add('/adminko/:controller', array(
'module' => "backend",
'controller' => 1,
'action' => "index"
))->setName('back-controller');
$router->add('/adminko/:controller/:action/:params', array(
'module' => "backend",
'controller' => 1,
'action' => 2,
'params' => 3
))->setName('back-full');
return $router;
};
$di['url'] = function(){
$url = new Phalcon\Mvc\Url();
$url->setBaseUri('/my-base-uri/');
return $url;
};
echo $di['url']->get(array("for" => "front-full", "controller" => "spunchbob", "action" => "sit"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment