doing php (please work)
This commit is contained in:
16
index.php
16
index.php
@@ -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;
|
||||
|
Reference in New Issue
Block a user