[Phplib-users] Template Problem between a script and a class
Brought to you by:
nhruby,
richardarcher
|
From: jerome l. <lo...@ho...> - 2003-04-14 15:43:34
|
Hi everybody,
Here is my problem,
i want to use the phplib template in a class and in a script at the same
time.
My script create the instance, which is transfered to my class function.
But nothing append !
Before i used to di this in perl with packages, but it don't seems to
work in php.
Here is the script :
include("../../Packages/Init.php"); //(contain all includes)
// Ouverture instance du template
$template =3D new Template("../html", "keep");
$utils=3D new Utils();
$template->set_file("recherche_client","recherche_client.html");
=20
// D=E9finition de variable dans le template
$template->set_var("PAGETITLE",$_SERVER['SERVER_NAME']);
---->>> Here is my problem. I pass template instance in my class. This
is ok, but my class don't fill my template.
$utils->Navigation($id_asp,$template,$db);
=20
---->>> End of my problem
$template->set_var("Nom_uti",$nom_uti);=20
$template->set_var("Prenom_uti",$prenom_uti);
=20
$template->set_var("Derniere_connexion_uti",$derniere_connexion_uti);
$template->set_var("Nb_result",$nb_result);
=20
=20
// Envoi des infos dans le template
$template->parse("OUT","recherche_client");
$template->p("OUT");
=20
Here is the code of my class :
=20
class Utils {
=20
function Navigation($id_asp,$template,$db)
{
=20
$template->set_block("recherche_client","row","rows");
$sql=3D"SELECT TITRE,IMAGE,IMAGE_ON,LIEN_DIRECT FROM RUBRIQUE =
WHERE
FK_ASP=3D".$id_asp;
list($result,$nb_result)=3D $db->db_query($sql);
while($i =3D mysql_fetch_array($result))
{
$template->set_var("Titre",$i["TITRE"]);
$template->set_var("Image",$i["IMAGE"]);
$template->set_var("Image_on",$i["IMAGE_ON"]);
$template->set_var("Lien",$i["LIEN_DIRECT"]);
$template->set_var("Src","src=3D".$i["IMAGE"]);
$template->set_var("Href","href=3D".$i["IMAGE"]);
$template->parse("rows","row", true);
}
=20
$template->set_var("Nom_uti",$nom_uti);=20
$template->set_var("Prenom_uti",$prenom_uti);
=20
$template->set_var("Derniere_connexion_uti",$derniere_connexion_uti);
$template->set_var("Nb_result",$nb_result);
}
=20
} =20
=20
I hope somebody will be able to help me.
Thanks for all
Jerome Longet
|