Files
DomFramework/examples/blog/index.php

70 lines
1.3 KiB
PHP

<?php
/** DomFramework Blog
@package domframework
@author Dominique Fournier <dominique@fournier38.fr> */
require_once ("domframework/route.php");
require_once ("domframework/renderer.php");
session_start();
error_reporting (E_ALL);
// Autoload des controllers
spl_autoload_register (
function ($class) {
if (file_exists ("controllers/controller_$class.php"))
include "controllers/controller_$class.php"; });
$route = new route ();
$route->debug =0 ;
$route->get ("",
function ()
{
$a = new blog ();
$a->listingHtml();
});
$route->get ("{articleid}.txt",
function ($articleid)
{
$a = new blog ();
$a->getTxt ($articleid);
});
$route->get ("{articleid}.xml",
function ($articleid)
{
$a = new blog ();
$a->getXml ($articleid);
});
$route->get ("{articleid}.json",
function ($articleid)
{
$a = new blog ();
$a->getJson ($articleid);
});
$route->get ("{articleid}/edit",
function ($articleid)
{
$a = new blog ();
$a->editShow ($articleid);
});
$route->post ("{articleid}/edit",
function ($articleid)
{
$a = new blog ();
$a->editSave ($articleid);
});
$route->get ("{articleid}",
function ($articleid)
{
$a = new blog ();
$a->getHtml ($articleid);
});
header ($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
echo "404 !";