Example #1
0
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Core PHP Framework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Core PHP Framework. If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    Core
 * @copyright  2008-2009 Gabriel Sobrinho <*****@*****.**>
 * @license    http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3)
 * @version    0.1
 */
// Buffer and error reporting
ob_start();
error_reporting(E_ALL | E_STRICT);
// Go to framework dir
chdir(dirname(__DIR__));
// Autoload
require_once 'core/functions.php';
// Set include path
$cwd = getcwd();
append_include_path("{$cwd}/core", "{$cwd}/app/models", "{$cwd}/app/controllers", "{$cwd}/app/helpers");
unset($cwd);
// Boot and dispatch request
Core::boot();
Controller\Router::dispatch();
Example #2
0
<?php

require 'Model/Db.php';
require 'Model/Product.php';
require 'Model/Product/Storage.php';
require 'Controller/Router.php';
require 'Controller/ProductController.php';
require 'Controller/ProductsController.php';
require 'View/Block/Product.php';
require 'View/Block/Products.php';
$config = (include 'conf/database.php');
Model\Db::setConfig($config);
$baseUrl = '/day-17/mvc/';
$url = str_replace($baseUrl, '', $_SERVER['REQUEST_URI']);
$router = new \Controller\Router();
$router->dispatch($url);