suche infos zu templates
Verfasst: 16.07.2004 17:27
da ich leider keine ahnung von der funktionsweiße von templates habe suche ich dazu infos im netz. oder kann mir hier einer erklären wie man templates erstellt?
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Naja ich dachte halt, dass man sich ja ein bisschen an der phpbb-Templatestruktur orientieren kann, daher habe ich die Links mal geschriebenScoutman hat geschrieben:danke das bezieht sich aber alles auf phpbb. ich will selber templates unabhängig von phpbb erstellen.
Code: Alles auswählen
<?php
function template ($tmpl_name, $tmpl_content, $dir) {
$pfad = "".$dir."/".$tmpl_name."";
$tmpl = file_get_contents($pfad);
if ( trim($tmpl) != "" ) {
$work = $tmpl;
if(isset($tmpl_content)) {
while ( list( $key, $val ) = each( $tmpl_content ) ) {
$x = "%%" . strtolower($key) . "%%";
$work = str_replace($x, $val, $work);
}
}
}
return $work;
}
?>
Code: Alles auswählen
<html>
<head><title>%%titel%%</title></head>
<body>%%inhalt%%
</body>
</html>
Code: Alles auswählen
$tmpl_name = 'dateiname.tpl';
require_once('./verzeichniss/class_template.php');
echo template ($tmpl_name, $tmpl_content, $dir);
Code: Alles auswählen
$tmpl_content['name'] = $name;
$tmpl_content['strasse'] = $strasse;
$tmpl_content['telefon'] = $telefon;
Code: Alles auswählen
<html>
<head><title></title></head>
<body>%%name%%<br \>
%%strasse%%<br \>
%%telefon%%<br \>
</body>
</html>