Hallo!
Ich habe auf meiner HP ein punBB-Forum installiert, das folgende header.php aufruft:
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :smile:
header('Pragma: no-cache');
$fp = fopen($pun\_root.'include/template/main.tpl', 'r');
$tpl\_main = trim(fread($fp, filesize($pun\_root.'include/template/main.tpl')));
fclose($fp);
$tpl\_main = str\_replace('', $lang\_common['lang\_direction'], $tpl\_main);
$tpl\_main = str\_replace('', $lang\_common['lang\_encoding'], $tpl\_main);
ob\_start();
if (isset($destination))
echo ''."\n";
else if (isset($validate\_form))
{
?\>
\<!--
function process\_form(theform)
{
\<?
if (isset($element\_names))
{
echo "\t".'var element\_names = new Object()'."\n";
while (list($elem\_orig, $elem\_trans) = @each($element\_names))
echo "\t".'element\_names["'.$elem\_orig.'"] = "'.addslashes($elem\_trans).'"'."\n";
?\>
if (document.images) {
for (i = 0; i \< theform.length; ++i) {
if (theform.elements[i].name.substring(0, 4) == "req\_") {
if ((theform.elements[i].type=="text" || theform.elements[i].type=="textarea" || theform.elements[i].type=="password" || theform.elements[i].type=="file") && theform.elements[i].value=='') {
alert("\"" + element\_names[theform.elements[i].name] + "\" \<? echo $lang\_common['required field'] ?\>")
return false
}
}
}
}
\<?
}
if (!strstr($\_SERVER['HTTP\_USER\_AGENT'], 'Opera'))
{
?\>
if (document.all || document.getElementById) {
for (i = 0; i \< theform.length; ++i) {
var elem = theform.elements[i]
if (elem.type.toLowerCase() == "submit")
elem.disabled = true
}
return true
}
\<?
}
?\>
return true
}
// --\>
}
$style = (isset($cur\_user)) ? $cur\_user['style'] : $pun\_config['o\_default\_style'];
?\>
$tpl\_temp = trim(ob\_get\_contents());
$tpl\_main = str\_replace('', $tpl\_temp, $tpl\_main);
ob\_end\_clean();
ob\_start();
if (isset($form\_name) && isset($focus\_element))
echo ' onLoad="document.getElementById(\''.$form\_name.'\').'.$focus\_element.'.focus()"';
$tpl\_temp = ob\_get\_contents();
$tpl\_main = str\_replace('', $tpl\_temp, $tpl\_main);
ob\_end\_clean();
$tpl\_main = str\_replace('', pun\_htmlspecialchars($pun\_config['o\_board\_title']), $tpl\_main);
$tpl\_main = str\_replace('', $pun\_config['o\_board\_desc'], $tpl\_main);
$tpl\_main = str\_replace('', generate\_navlinks(), $tpl\_main);
if ($cookie['is\_guest'])
$tpl\_temp = $lang\_common['Not logged in'];
else
$tpl\_temp = $lang\_common['Logged in as'].' **'.pun\_htmlspecialchars($cur\_user['username']).'**.
'.$lang\_common['Last visit'].': '.format\_time($cur\_user['last\_visit']);
if ($cur\_user['status'] \> PUN\_USER)
{
$result\_header = $db-\>query('SELECT COUNT(id) FROM '.$db-\>prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', \_\_FILE\_\_, \_\_LINE\_\_, $db-\>error());
if ($db-\>result($result\_header, 0))
$tpl\_temp .= '
[There are new reports](admin_reports.php)';
if ($pun\_config['o\_maintenance'] == '1')
$tpl\_temp .= '
[Maintenance mode is enabled!](admin_options.php%23maintenance)';
}
$tpl\_main = str\_replace('', $tpl\_temp, $tpl\_main);
?\>
Im main.tpl-Template steht nichts sonderlich Spannendes, nur meine Kopfzeilen ( …) und dieses:
Jetzt meine Frage: Wie kriege ich es hin, dass das Forum das Template ignoriert und stattdessen meine eigene Header-Datei nach dem Schema
include("../php/layout/oben.php"); ?\>
einbaut? Wenn ich den Tag in die tpl-Datei einbaue, geht es nicht, auch nicht, wenn ich sie in main.php umbenenne (sowohl die Datei an sich, als auch den Aufruf in der header.php).
Auf den include-Tag verzichten und die oben.php komplett in die main.php reinkopieren, kann und möchte ich auch nicht, weil sie if-Bedingungen enthält, die dann wiederum nicht funktionieren. Ein Teufelskreis.
Ich glaub, langsam sehe ich auch den Wald vor lauter Bäumen nicht mehr, bin auch leider nicht der große PHP-Experte. Würde mich aber über Hilfe sehr freuen.
Danke im Voraus,
Matthias