Move some stuff to templateParameters.php
This commit is contained in:
parent
ce8952d297
commit
8af49c59d7
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
if(!isset($_SESSION)) session_start();
|
||||
include_once("templateParameters.php");
|
||||
|
||||
if ($templateParameters["render"] === FALSE) {
|
||||
|
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
if(!isset($_SESSION)) session_start();
|
||||
include_once("templateParameters.php");
|
||||
|
||||
// When including this template from other directories, using relative url paths is not sufficient. Therefore we use a prefix to ensure that the correct url path is given.
|
||||
// Typically we put this before any local urls, such as navigation, icons etc to ensure that they use the correct path.
|
||||
$templateUrlPrefix = dirname(str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath(__DIR__)));
|
||||
if ((strlen($templateUrlPrefix) > 1)) {
|
||||
$templateUrlPrefix = htmlspecialchars($templateUrlPrefix . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
if ($templateParameters["render"] === FALSE) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
if(!isset($_SESSION)) session_start();
|
||||
|
||||
// Default parameter values if none is defined
|
||||
$defaultTemplateParameters = [
|
||||
"title" => "Document", // Set page title
|
||||
@ -9,3 +11,12 @@ $defaultTemplateParameters = [
|
||||
foreach(array_keys($defaultTemplateParameters) as $key) {
|
||||
if (!isset($templateParameters[$key])) $templateParameters[$key] = $defaultTemplateParameters[$key];
|
||||
}
|
||||
|
||||
// When including a template from other directories, using relative url paths is not sufficient. Therefore we use a prefix to ensure that the correct url path is given.
|
||||
// Typically we put this before any local urls, such as navigation, icons etc to ensure that they use the correct path.
|
||||
if (empty($templateUrlPrefix)) {
|
||||
$templateUrlPrefix = dirname(str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath(__DIR__)));
|
||||
if ((strlen($templateUrlPrefix) > 1)) {
|
||||
$templateUrlPrefix = htmlspecialchars($templateUrlPrefix . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user