Re: [SMARTY] Newbie help
| From: | messju mohr | Date: | Thu, 03 Apr 2003 07:27:18 +0000 |
| Subject: | Re: [SMARTY] Newbie help | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9048@lists.php.net to get a copy of this message | ||
On Wed, Apr 02, 2003 at 08:59:37PM -0500, Daniel McCullough wrote:
> I'm new to Smarty, liking it, getting used to it.
> I am going to need to pull information out of a database and do certain
> things with it. Can that be done inside of smarty or does that have to be
> done before you define Smarty class.
this should not be done inside smarty. pull your data in php and assign
it as smarty-variables.
the smarty crashcourse does this as a starter:
include('Smarty.class.php');
// create object
$smarty = new Smarty;
// assign some content
/* replace these two lines with your queries and assign the query results
instead of constant strings: */
$smarty->assign('name', 'george smith');
$smarty->assign('address', '45th & Harris');
// display it
$smarty->display('index.tpl');
the crashcourse is at:
http://smarty.php.net/crashcourse.php
there is also an example with arrays. you'll need this if you want
to display multiple rows of you db in a html-table or sth like that.
HTH
messju
> Anyone have an example?
>
> thanks