Answer the question
In order to leave comments, you need to log in
How to make static pages (similar to the one in dl)?
Briefly speaking. The point is simple. I want the site to have multiple pages. There is a simple code
<?php
$html = file_get_contents( '../templates/default/main.tpl' );
$html = str_replace( '{TITLE}', $title, $html );
$html = str_replace( '{CONTENT}', $content, $html );
$html = str_replace( '{LOGIN}', $login, $html );
$html = str_replace( '{INFO}', $info, $html );
$html = str_replace( '{PAGE}', $page, $html );
$html = str_replace( '{REG}', $reg, $html );
echo $html;
?>
Answer the question
In order to leave comments, you need to log in
scatter everything over tpl files, and then include where you need to display a specific block,
for example, like this
<?php
function render($mainTpl, $Content)
{
if(file_exists($mainTpl)){
include $mainTpl;
}
}
?>
maintpl.tpl
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<? include $content; ?>
</body>
</html>
и вызываем
render( '.../maintpl.tpl','.../reg.tpl');
render( '.../maintpl.tpl','.../reg.tpl');
это самый простой способ но все же он лучше чем str_replace
но его можно развить и сделать очень удобным
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question