logo       

Re: Re[2]: [SMARTY] cache lifetime specified with a timestamp for each temp: msg#00431

php.smarty.general

Subject: Re: Re[2]: [SMARTY] cache lifetime specified with a timestamp for each template

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@xxxxxxxx>


--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise