[Phplib-users] Header and footer puting
Brought to you by:
nhruby,
richardarcher
From: Horst K. <Hor...@lo...> - 2003-08-22 07:47:09
|
Hello list,=20 I'm a new user of Phplib - template - and I need somme help. I try to insert an HTML Header, Header and Footer in a page with template, = and it doesn't work correctly.=20 Here you are my code:=20 =3D=3D=3D=3D=3D=3D=3D=3D t1.tpl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 {HTMLHEAD} <Center> {HEADER} <Table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" Width=3D"500"> <th colspan=3D"4" Align=3D"Left">{NOMBRE_ENREGISTREMENTS} = Enregistrements</th> <!-- BEGIN RESPONSABLEBLOCK --> <tr> <td>{RESPONSABLE_ID}</td><td>{RESPONSABLE_NOM}</a></td><td>= {RESPONSABLE_PRENOM}</td><td><a href=3D"mailto:{RESPONSABLE_EMAIL}">{RESPON= SABLE_EMAIL}</a></td> </tr> <!-- END RESPONSABLEBLOCK --> </Table> {FOOTER} </Center> </Body> </Html> =3D=3D=3D=3D=3D End t1.tpl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 =3D=3D=3D=3D=3D=3D=3D=3D t1.php =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 <?PHP // Connection =E0 la base de donn=E9es @mysql_connect("MyHost", "MyUserName", "MyPassword") or die(mysql_errno() = & " - " & mysql_error()); @mysql_select_db("elogbook") or die(mysql_errno() & " - " & mysql_error());= // requ=EAte SQL $sql =3D " SELECT responsable_id, responsable_nom, responsable_prenom, responsable_email FROM responsables WHERE responsable_email LIKE '%@%.ch' ORDER BY responsable_nom, responsable_prenom " ; // Ex=E9cution de la requ=EAte sql et r=E9cup=E9ration des donn=E9es $result =3D mysql_query($sql); // D=E9connection de la base de donn=E9es mysql_close(); /////////////////////////////////////////////// // Insertion de la classe PHPLIB include "template/template2.inc"; // Cr=E9ation du template $tpl =3D new template("./"); // Indication du fichier servant de mod=E8le $tpl->set_file("t1", "t1.tpl"); /////////////////////////////////////////////// // Traitement des informations /* Ent=EAte HTML */ $tpl->set_var("HTMLHEAD", stristr(include("htmlhead.html"), 1)); /* Block Ent=EAte de page */ $tpl->set_var("FOOTER", stristr(include("header.html"), 1)); /* Pied de page */ $tpl->set_var("FOOTER", stristr(include("footer.html"), 1)); /* Block RESPONSABLE */ // Cr=E9ation du block $tpl->set_block("t1", "RESPONSABLEBLOCK", "responsableblock"); // Nombre d'enregistrements $tpl->set_var("NOMBRE_ENREGISTREMENTS", mysql_numrows($result)); while ($val =3D mysql_fetch_array($result)){ // On parcoure les r=E9sultats= de la requ=EAte $tpl->set_var("RESPONSABLE_ID", $val["responsable_id"]); $tpl->set_var("RESPONSABLE_NOM", $val["responsable_nom"]); $tpl->set_var("RESPONSABLE_PRENOM", $val["responsable_prenom"]); $tpl->set_var("RESPONSABLE_EMAIL", $val["responsable_email"]); $tpl->parse("responsableblock", "RESPONSABLEBLOCK", true); } // Traitement de la page $tpl->parse("parse", "t1"); // Affichage de la page $tpl->p("parse"); ?> =3D=3D=3D=3D=3D End t1.php =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 Thanks for your help=20 Horst=20 PS: Sorry for my poor English.=20 |