renderer : add the html support directely in renderer

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2208 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-08-05 11:48:44 +00:00
parent 59ae5b8e28
commit 1c58f8ae17

View File

@@ -97,4 +97,25 @@ class renderer
}
}
}
/** @param mixed $data The data to display.*/
static function html ($viewclass, $viewmethod, $data,
$layoutfile = "views/layout.html", $route = null)
{
if ($layoutfile !== false && ! file_exists ($layoutfile))
throw new Exception ("Layout file $layoutfile not found", 500);
require_once ("domframework/outputhtml.php");
if ($route === null)
$route = new route ();
$html = new outputhtml ();
$replacement = array ("{baseurl}"=>$route->baseURL (),
"{baseurlresource}"=>$route->baseURLresource ());
echo $html->out ($data,
FALSE,
$viewclass, $viewmethod,
$layoutfile,
$replacement);
}
}