<?php function pre($url, $str) { echo "<pre style='background:#f1f1f1;border:1px solid #b1b1b1;padding:10px;margin:10px 0;'>{$url}\n\r" . print_r($str, true) . "</pre>"; } //Include ROUTE CLASS: include dirname(__FILE__) . 'routeclass.php'; Route::$request[] = array(array('request' => '/', 'action' => 'index', 'test' => 'go'), array('request' => '/<lang>/catalog(/<test>)', 'action' => 'catalog_review'), array('request' => '/news(/page/<pagination>|/<page>)', 'action' => 'news'), array('request' => '/<lang>/<action>', 'action' => 'page'), 'controller' => 'main', 'param' => array('lang' => '[a-z]{2}', 'action' => '(contact|servise|go|[a-z]{5,25})', 'page' => '[a-z0-9_\\-]{5,25}', 'pagination' => '[0-9]{1,2}', 'year' => '[0-9]{4}')); pre('/', Route::matchURI('')); pre('/ru/import', Route::matchURI('/ru/import')); pre('/ru/go', Route::matchURI('/ru/go')); pre('/ru/catalog', Route::matchURI('/ru/catalog')); // OR /ru/catalog/additional_parameter pre('/news/page/23', Route::matchURI('/news/page/23')); pre('/news/title_news', Route::matchURI('/news/title_news'));
<?php include 'config.php'; use _site\controllers\ErrorController; use _site\classes\SConfig; use _site\classes\SRun; $urlrewrited = isset($_GET['urlrewrited']) ? $_GET['urlrewrited'] : ''; Route::$request[] = array(array('request' => '/', 'controller' => 'home', 'action' => 'view'), array('request' => 'portfolio/job(/<id>/<name>)', 'controller' => 'portfolio', 'action' => 'job'), 'param' => array('name' => '[a-z0-9_\\-]{5,25}', 'id' => '[0-9]{1,4}')); $route = Route::matchURI($urlrewrited); $app = new SRun(); $app->init($route);