doing php (please work)

This commit is contained in:
2024-01-25 12:48:58 +01:00
parent e03f3b5e0c
commit 9e768198f6
3 changed files with 15 additions and 5 deletions

View File

@@ -82,16 +82,24 @@ if (isset($_SESSION['user_id'])) {
$page_regex = '/<!--PAGENAME=(.*?)-->/s';
$page_style_regex = '/<!--PAGESTYLE=(.*?)-->/s';
if(preg_match($page_regex, $page_data, $matches)){
if (preg_match($page_regex, $page_data, $matches)) {
$page_name = $matches[1];
$page_data = preg_replace($page_regex, '', $page_data);
}
else{
} else {
$page_name = ucfirst($page);
}
$output = str_replace('<template name="page name">', $page_name, $output);
if (preg_match($page_style_regex, $page_data, $style_matches)) {
$page_style = $style_matches[1];
$page_data = str_replace('<template name="page styling">', $page_style, $page_data);
} else {
$page_style = "/styles/pages/$page_name.css";
$page_data = str_replace('<template name="page styling">', $page_style, $page_data);
}
$output = str_replace('<template name="page name">', $page_style, $output);
$output = str_replace('<template name="page content">', $page_data, $output);
echo $output;