RE: [SMARTY] ADODB
| From: | Gary Loescher | Date: | Wed, 26 Mar 2003 04:17:07 +0000 |
| Subject: | RE: [SMARTY] ADODB | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8911@lists.php.net to get a copy of this message | ||
>I've a running PHP with adodb and I'm trying to change the structure to
>smarty so it would be a better in control. Any suggestion?
You don't need to change anything in ADODB to make it work with Smarty.
I think there's some confusion here. Smarty will work with _any_
database abstraction layer, because it has nothing to do with
databases and their contents. So, with ADODB, the architecture
would work something like:
0. You write a template called 'foo.tpl' that uses Smarty template
variables. The variables will be filled in later with DB data.
1. A page request comes in (such as in the URL query string, ie
"page=foo")
2. Your php code creates an ADOConnection object, then uses it to
execute a SQL query to get whatever info it needs
3. php code creates an instance of the Smarty object
4. php code populates Smarty template variables with the
information from the database (iterate over ADORecordset, etc)
5. php code calls $smarty->display('foo.tpl') and the page is
rendered.
Hope that helps to clarify,
Gary