Rework of blog example to be compliant with version of domframework

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1551 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-07-25 12:40:19 +00:00
parent 11624f512b
commit 92fbf288f7
5 changed files with 157 additions and 22 deletions

View File

@@ -3,18 +3,67 @@
@package domframework
@author Dominique Fournier <dominique@fournier38.fr> */
require_once ("domframework/route.php");
require_once ("domframework/renderer.php");
$route = new route ();
$route->debug =0 ;
$res = $route->routingCollection (array (
//"" => array ("route", "redirect", "/1", FALSE),
"" => array ("blog", "listingHtml"),
"{page}.xml" => array ("blog", "getXml", "{page}"),
"{page}.html" => array ("blog", "getHtml", "{page}"),
"{page}.csv" => array ("blog", "getCsv", "{page}"),
"{page}.json" => array ("blog", "getJson", "{page}"),
"{page}.txt" => array ("blog", "getTxt", "{page}"),
"{page}" => array ("blog", "getHtml", "{page}"),
));
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 !";