RE: [SMARTY] Templates in DB
| From: | Simon H | Date: | Sun, 02 Jun 2002 13:02:36 +0000 |
| Subject: | RE: [SMARTY] Templates in DB | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4500@lists.php.net to get a copy of this message | ||
> For basics on how to use Smarty & PEAR DB, take a look at
> http://www.zend.com/zend/tut/tutsweatpart1.php and
> http://www.zend.com/zend/tut/tutsweatpart2.php. This series of
> tutorials is
> on just that subject.
Thanks, this will help with the DB based content!
> These tutorials deal with regular template, but there is a way to override
> the default template resource and retrieve them from a database. You might
> try searching this list archive, I think this topic was discussed around
> Nov-Dec of last year.
I had a look at this, but much prefer the method described in:
http://smarty.php.net/manual/en/plugins.resources.html
and
http://smarty.php.net/manual/en/templates.from.elsewhere.html
...since it will be easier to upgrade when required.
I just need to know where to put the DB connectivity/config stuff, and whether
PEAR DB is required for the plugin method described in the docs...I like PEAR DB
and have used it before in basic apps, so have no problem using it, but my PHP
is still reasonably basic. I'm still trying to come to terms with the Smarty
architecture.
I have no previous programming experience other than HTML (not really
programming...I know) so its all new to me.
Thanks again Jason!
Simon H
>
> Hope that helps.
>
> Jason
> >
> > Hi All!!
> >
> > I'm very new to Smarty, and am trying to retrieve both site content/block
> > contents and templates from a DB.
> >
> > Starting with the template; I found info on this in the documentation at:
> >
> > http://smarty.php.net/manual/en/plugins.resources.html
> >
> > So I created the plugin accordingly. I haven't ran this yet, as I can't
> see how
> > it knows what database to connect to, or where the database settings are.
> >
> > Is the method shown, for use with PEAR DB? If so, where do I put the PEAR
> > includes - within the Plugin? Regardless some further information
> describing
> > how to setup DB connectivity in Smarty for Template/content storage would
> be
> > most helpful, and much appreciated.
> >
> > TIA
> >
> > Simon H