(19 дек 2013, 15:43) (
0/
0)
[
0]
Fallen,
Ну у меня так идет) хотя я сама еще в этом слаба:
<?php
$url = str_replace(\'/dir/\', \'\', $_SERVER[\'REQUEST_URI\']);
$routes = array(
array(
\'url\' => \'#^register#i\',
\'view\' => \'pages/register\',
\'controller\' => \'register\'
),
array(
\'url\' => \'#^changepassword#i\',
\'view\' => \'pages/changepassword\',
\'controller\' => \'changepassword\'
),
array(
\'url\' => \'#^login#i\',
\'view\' => \'pages/login\',
\'controller\' => \'login\'
),
array(
\'url\' => \'#^logout#i\',
\'view\' => \'pages/logout\',
\'controller\' => \'logout\'
),
array(
\'url\' => \'#^profile#i\',
\'view\' => \'pages/profile\',
\'controller\' => \'profile\'
),
array(
\'url\' => \'#^update#i\',
\'view\' => \'pages/update\',
\'controller\' => \'update\'
),
array(
\'url\' => \'#^crop#i\',
\'view\' => \'pages/crop\',
\'controller\' => \'crop\'
),
array(
\'url\' => \'#^photo#i\',
\'view\' => \'pages/photo\',
\'controller\' => \'photo\'
),
);
foreach ($routes as $route) {
if (preg_match($route[\'url\'], $url, $match)) {
$view = $route[\'view\'];
$controller = $route[\'controller\'];
break;
}
}
if (empty($match)) {
require_once \'views/index.php\';
exit();
}
extract($match);
require_once \"controllers/{$controller}.php\";
require_once \"views/{$view}.php\";
?>
(19 дек 2013, 15:39) (
0/
0)
[
0]
Там по началу за мудрено... После кажется все простым)