Hi Christoph,
you can use the code or only the idea of a fallback template, however you want
In reality nobody can switch per backend to a not existing template. In the most cases it happens, if somebody deletes or renames an activated template.
cmb wrote:As indeed in this rare case only a fallback template is necessary, what about hardcoding an absolute minimum to the core?
Yes, it's possible, for example:
Code: Select all
if (!include($pth['file']['template'])) {
echo '<!DOCTYPE html>
<html>
<head>';
echo head();
echo '</head>';
echo '<body>
<div style="width: 480px; margin: 0 auto;">';
echo '<div style="background: #eee; color: #c00; font-size: 20px; letter-spacing: 2px; text-align: center; font-weight: 700; border: 5px solid #c00; padding: 24px; margin: 20px 0;">
<p><b>!!! Template is missing !!!</b></p>'
. loginlink() . '</div>';
echo content();
echo '</div>
</body>
</html>';
}
But the effect, if it happens online, is better with a complete fallback template, like a copy of the default template. And I do not believe, that anybody (normal user) deletes or modifies a template __fallback__ in top of the list,
Gert
PS: The code above maybe the absolutely fallback, if anybody deletes the __fallback__ template.