Skip to content

Instantly share code, notes, and snippets.

@phalcon phalcon/z.php
Created Jan 30, 2013

Embed
What would you like to do?
<?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
You can’t perform that action at this time.