Re: {section} question
| From: | Monte Ohrt | Date: | Wed, 28 Feb 2001 16:31:31 +0000 |
| Subject: | Re: {section} question | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-240@lists.php.net to get a copy of this message | ||
Clayton,
What you are referring to is perfectly acceptable, that is what custom
functions are for. You can create functions that are specific to your
application. In your example, the function masks/limits/simplifies what
actually happens at the SQL level. We do something similar to this that
handles search query results and pagination (using insert tag)
What I was referring to (as a no-no) is a generic SQL call from the
template, maybe something like this:
{sql query="select first,last,username from users"}
{$last},{$first}<br>
{/sql}
clayton collie wrote:
>
> > SQL queries in the templates... we've been at this crossroads before
> > (Andrei and I), and all I can say is it leads you to begin using the
> > template engine in a way that it was not intended to be used.
>
> Monte,
>
> i have a (slightly) different opinion on this issue. im working on a
> community-web framework, and im imagining classes of users : (1) the
> site-wide admin (2) group/module admins (3) regular users.
> i'd like to empower the site-wide administrator to customize the site in
> ways that dont require mucking around in the PHP source code, or having to
> have too deep a knowledge of the structure to make certain changes,
> especially at the UI level. as a simple example, if he decides to create a
> listing of registered users of group "clients", i could provide a tag to
> fetch the members:
>
> {members group="clients" active="true" name="memberlist"
> fields="*"}
> {section name="membersection" loop=$memberlist}
> Name : {$membersection/memberlist.name}
> {/section}
>
> the framework would take care of authentication, etc
>
> this would make the framework a lot more extensible, although it does begin
> to resemble ColdFusion <g>
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/