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;
|
$resView = $data;
|
||||||
if ($viewClass !== FALSE && $viewMethod !== FALSE)
|
if ($viewClass !== FALSE && $viewMethod !== FALSE)
|
||||||
{
|
{
|
||||||
if ($module !== "")
|
if (! class_exists ($viewClass))
|
||||||
require_once ("modules/$module/views/$viewClass.php");
|
{
|
||||||
else
|
if ($module !== "")
|
||||||
require_once ("views/$viewClass.php");
|
require_once ("modules/$module/views/$viewClass.php");
|
||||||
|
else
|
||||||
|
require_once ("views/$viewClass.php");
|
||||||
|
}
|
||||||
$obj = new $viewClass;
|
$obj = new $viewClass;
|
||||||
$resView = $obj->$viewMethod ($data, $variable);
|
$resView = $obj->$viewMethod ($data, $variable);
|
||||||
if (is_array ($resView))
|
if (is_array ($resView))
|
||||||
@@ -58,10 +61,30 @@ class outputhtml extends output
|
|||||||
$layoutPage = $this->layoutVariables ($layout, $variable);
|
$layoutPage = $this->layoutVariables ($layout, $variable);
|
||||||
$resView = str_replace ("{content}", $resView, $layoutPage);
|
$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
|
// Do the title replacement in the replacement structure
|
||||||
if (! isset ($replacement["{title}"]))
|
if (! isset ($replacement["{title}"]))
|
||||||
$replacement["{title}"] = $title;
|
$replacement["{title}"] = $title;
|
||||||
|
if (! isset ($replacement["{flash}"]))
|
||||||
|
$replacement["{flash}"] = "";
|
||||||
|
|
||||||
foreach ($replacement as $key=>$val)
|
foreach ($replacement as $key=>$val)
|
||||||
$resView = str_replace ($key, $val, $resView);
|
$resView = str_replace ($key, $val, $resView);
|
||||||
|
|||||||
Reference in New Issue
Block a user