Export html head to one php file
Closed this issue · 1 comments
mueller-ma commented
You could create a file like this called head.php:
<?php
echo "<!DOCTYPE html><html><head>
<title>".$title."</title>
<meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">
<meta HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">
<meta charset=\"UTF-8\">
".$extraHead."
</head><body>";
And use it in e.g. käseformular.html like this:
<?php
$title="Käsebestellung";
$extraHead="<meta name=\"viewport\" content=\"width=device-width\">" //this line is optional. with it you can add lines to your html head
include "head.php";
?>
This way you save time and get rid of problems with cache and german umlaute since you use UTF-8.
mueller-ma commented
Depending on your apache config php code might not get executed in .html files. Just rename all files to .php. Having plain html in a php works, when you close the php block with "?>"