Re: Re[6]: AW: [SMARTY] Paging
| From: | Nick Charsley | Date: | Thu, 12 Dec 2002 15:41:18 +0000 |
| Subject: | Re: Re[6]: AW: [SMARTY] Paging | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6772@lists.php.net to get a copy of this message | ||
RS> if passing the query is not ideal, then can anyone suggest a better way
RS> to do this?
That depends on if the query's are parameterised or static. If they are
static, then putting them in an associative array and then the function
would accept and call the query by index.
By static, I mean they don't need variables passed from the template.
psuedo-code
<?php
$Active=$_get['ShowActive'];
$query['all customers']='select * from tblCustomers';
$query['selected customer]="select * from tblCustomers where bolActive =
$Active";
$query['customer]="select * from tblCustomers where bolActive=@p1 and
strState='@p2'";
?>
then in the tpl:
{return_paged_results query='selected customer'}
the main downside I can see is that this array could get quite large in a
big system, and so would need extra managing.
It may also be possible to parameterise the query, where we would have
{return_paged_results query='customer' param1=0 param2='CA'}
not really sure if this make sense.. I probably do it the worst way (upto
now), by creating and regestering a user function for each query so I would
have fnAllCustomers(), fnSelectedCustomer() and
fnCustomer($smartyPackedArguments).
Nick (c)