Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export html head to one php file #3

Closed
mueller-ma opened this issue Apr 3, 2017 · 1 comment
Closed

Export html head to one php file #3

mueller-ma opened this issue Apr 3, 2017 · 1 comment

Comments

@mueller-ma
Copy link
Collaborator

mueller-ma commented Apr 3, 2017

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
Copy link
Collaborator Author

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 "?>"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant