You stuf is simply great ! (Re:Basic question about passing variables)

From: Date: Wed, 25 Apr 2001 22:30:04 +0000
Subject: You stuf is simply great ! (Re:Basic question about passing variables)
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-588@lists.php.net to get a copy of this message
Ort, After playing around few hours, I start to understand things better and really Smarty was THE thing I was looking for for long !! Congratulations. For my question about passing variables (in case other newcomers browse this list) to be passed to a template a variable must be first declared in the main php file so my index.php?op=topic I had to declare it as $template->assign("op",$op); I had no problem in using a mySQL database with the standard methods mysql_query("select ......'"); while($row=mysql_fetch_row($query)) { and so on Display with a {select ...}
Hi Luc, It looks like you have a class that generates HTML tables, as well as the content within the table. Normally you would want full control of your HTML layout handled by the template engine (Smarty). You would accomplish this by having your class return _only_ the data structure. You would then assign this data structure to the template, and then let the template generate the HTML tables that go around the data using {section}{/section} loops.
Yep, I'll do this but right now I'm doing a mockup of my "old" Nuke site with Smarty reproducing thing exactly as they were, hen this will be done (and I had learnt a lot of things about Smarty) I'll re-think it in a more constructive way..)
However, if you want to leave your class as-is and just inject its output into the template, you can do this easily by creating a custom function that calls your class and returns the output.
Right now I'm trying to do that, but as I succeed with a classical database connection, I'll end succeeding with my class (I prefer to use class its more convenient) A last question for tonight, as Smarty uses PEAR.. and as PEAR as no template package;;is there any plans to integrate Smarty in PEAR ? Luc

« previous php.smarty.general (#588) next »