Smarty progress report
| From: | Monte Ohrt | Date: | Tue, 10 Apr 2001 18:55:11 +0000 |
| Subject: | Smarty progress report | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-516@lists.php.net to get a copy of this message | ||
Hi!
It's been mostly quiet around here, so I thought I'd mention what's been
going on with Smarty. Basically, much of Smarty has been rewritten to
make way for arbitrary template sources. I'd like to say that my first
attempt at the new code seems to work. Is that good or bad? :) Smarty
now compiles templates at run-time instead of compiling everything
upfront, which means Smarty can handle arbitrary template sources.
examples:
{* including from $template_dir (backward compatible) *}
{include file="header.tpl"}
{include file="extras/poll.tpl"}
{* including from any directory *}
{include file="file://export/httpd/templates/shared/banner.tpl"}
{include file="file://absolute/path/to/template.tpl"}
{* including from database source *}
???
The first two examples pull templates from the $template_dir directory,
which is the way Smarty works now. The second two examples include
templates from arbitrary directories, using the full system path name.
Smarty will also support other types of template sources, such as
databases. I haven't quite landed on a syntax for this yet, so this will
be forthcoming. It will be utilizing the database abstraction functions
in PEAR (aren't you glad we require this now? ;) It might look something
like {include
file="db://username:password@protocol+hostspec/database/tablename/footer.tpl"}
Either something like that, or a simpler mapping, so in the template you
might have {include file="mydb://footer.tpl"}, and in smarty you would
register "mydb" as a database resource.
Comments/suggestions/etc welcome. I'd like to get as much braintrust in
on this as I can while the code is still fresh ;)
Monte
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/