outputhtml : add a basic HTML page when there is nothing declare
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2236 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -33,10 +33,13 @@ class outputhtml extends output
|
||||
$resView = $data;
|
||||
if ($viewClass !== FALSE && $viewMethod !== FALSE)
|
||||
{
|
||||
if ($module !== "")
|
||||
require_once ("modules/$module/views/$viewClass.php");
|
||||
else
|
||||
require_once ("views/$viewClass.php");
|
||||
if (! class_exists ($viewClass))
|
||||
{
|
||||
if ($module !== "")
|
||||
require_once ("modules/$module/views/$viewClass.php");
|
||||
else
|
||||
require_once ("views/$viewClass.php");
|
||||
}
|
||||
$obj = new $viewClass;
|
||||
$resView = $obj->$viewMethod ($data, $variable);
|
||||
if (is_array ($resView))
|
||||
@@ -58,10 +61,30 @@ class outputhtml extends output
|
||||
$layoutPage = $this->layoutVariables ($layout, $variable);
|
||||
$resView = str_replace ("{content}", $resView, $layoutPage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No layout : display a very basic HTML page
|
||||
$layoutPage = <<< EOT
|
||||
<!DOCTYPE html>
|
||||
<html lang='en'>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>{title}</title>
|
||||
</head>
|
||||
<body>
|
||||
{flash}
|
||||
{content}
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
$resView = str_replace ("{content}", $resView, $layoutPage);
|
||||
}
|
||||
|
||||
// Do the title replacement in the replacement structure
|
||||
if (! isset ($replacement["{title}"]))
|
||||
$replacement["{title}"] = $title;
|
||||
if (! isset ($replacement["{flash}"]))
|
||||
$replacement["{flash}"] = "";
|
||||
|
||||
foreach ($replacement as $key=>$val)
|
||||
$resView = str_replace ($key, $val, $resView);
|
||||
|
||||
Reference in New Issue
Block a user