Перенёс автолоад, убрал меню

This commit is contained in:
Krivchikov Dmitry 2014-04-03 16:55:54 +04:00
parent 77e535ce96
commit d2dd7b9dd0
4 changed files with 27 additions and 33 deletions

View File

@ -1,5 +1,26 @@
<?php <?php
function __autoload($className)
{
$dirs = array('classes','models','controllers');
$loaded = flase;
foreach ($dirs as $dir) {
$fileName = dirname(__FILE__) . '/../ground/' . $dir. '/' . $className . '.php';
if (file_exists($fileName)){
$loaded = (bool) include $fileName;
}
}
if (!$loaded){
App::error404 ('load class '.$className);
return false;
}
return true;
}
class App class App
{ {
private static $url = array(); private static $url = array();
@ -8,7 +29,7 @@ class App
private static $basedir = false; private static $basedir = false;
private static $config = array(); private static $config = array();
private static $urlParams = array(); private static $urlParams = array();
public static $DB = null; public static $DB = null;
/** /**
* Разбивает урл на контроллер, метод и выбирает параметры. * Разбивает урл на контроллер, метод и выбирает параметры.

View File

@ -19,10 +19,6 @@
<body> <body>
<div class="header"> <div class="header">
<h1>WikiPoints</h1> <h1>WikiPoints</h1>
<a href="/">Главная</a> |
<a href="/json/points/">Точки</a> |
<a href="/json/point/id/1">Выбранная точка</a> |
<a href="/json/categories/">Категории</a>
</div> </div>
<?= isset($content) && !empty($content) ? $content : 'No content =(' ?> <?= isset($content) && !empty($content) ? $content : 'No content =(' ?>
</body> </body>

View File

@ -11,6 +11,6 @@ body {margin: 0; padding: 0; height: 100%;}
div#map {width: 100%; height: 100%;} div#map {width: 100%; height: 100%;}
div.infoCard {width: 400px;} div.infoCard {width: 400px;}
div.infoCard img {width: 200px; float: left; margin: 0 10px 5px 0;} div.infoCard img {width: 200px; float: left; margin: 0 10px 5px 0;}
div.header {display: block; position: absolute; top: 0; left: 115px; border-radius: 0 0 5px 5px; z-index: 1000; background-color: #FFF; padding: 5px 10px;} div.header {display: block; position: absolute; top: 0; left: 110px; border-radius: 0 0 5px 5px; z-index: 1000; background-color: #FFF; padding: 5px 10px;}
div.header h1 {display: inline; margin-right: 25px; color: #555;} div.header h1 {display: inline; color: #555;}
div.add {cursor: pointer;} div.add {cursor: pointer;}

View File

@ -1,29 +1,6 @@
<?php <?php
// Поехали! include_once dirname(__FILE__) . '/../ground/app.php';
include_once dirname(__FILE__) . '/../ground/config.php';
function __autoload($className) App::run($config);
{
$dirs = array('classes','models','controllers');
$loaded = flase;
foreach ($dirs as $dir) {
$fileName = dirname(__FILE__) . '/../ground/' . $dir. '/' . $className . '.php';
if (file_exists($fileName)){
$loaded = (bool) include $fileName;
}
}
if (!$loaded){
App::error404 ('load class '.$className);
return false;
}
return true;
}
include_once dirname(__FILE__) . '/../ground/app.php';
include_once dirname(__FILE__) . '/../ground/config.php';
App::run($config);