Re: Re[2]: [SMARTY] cache lifetime specified with a timestamp for each template
| From: | Monte Ohrt | Date: | Wed, 29 Jan 2003 23:11:08 +0000 |
| Subject: | Re: Re[2]: [SMARTY] cache lifetime specified with a timestamp for each template | ||
| References: | 1 2 3 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-649@lists.php.net to get a copy of this message | ||
To pass $exp_time to display(), it would have to be passed after the
(optional) cache_id and compile_id params, which means null would need
to be passed if they aren't set.
$smarty->display('index.tpl',$cache_id,$compile_id,$exp_time);
$smarty->display('index.tpl',$cache_id,null,$exp_time);
$smarty->display('index.tpl',null,null,$exp_time);
Then what? Another null for the next new parameter?
That's why it was done the other way. This is an issue with any of the
API calls. Every new parameter means you might have to pass nulls if any
params before it are optional. :(
An alternate method to pass an associative array as param1:
$smarty->display(array('name' => 'index.tpl',
'cache_id' => $cache_id,
'exp_time' => 600));
To maintain backward compatability I would have to test if param1 is an
array, if so then use this new format. Then the args are more adapatable
to new stuff, but this does require a test for arg format on every
invocation (extra step.) This may not work on every API call, some might
already accept an array as arg1. I suppose I could test something like
isset($arg1['name']).
Just some ideas, but would this be a good direction to go in general?
Monte
On Wed, 2003-01-29 at 16:48, Uros Gruber wrote:
> Hi,
>
> Can i make patch that it is possible with argument to.
>
> Less writing :))
--
Monte Ohrt <monte@ispi.net>