[pLog-general] Life Type + Smarty + register_function()
Jon Daley
plogworld at jon.limedaley.com
Wed Aug 13 07:40:03 EDT 2008
I don't know a whole lot about it, but I have always used smarty's
plugin system when adding stuff to smarty.
On Tue, 12 Aug 2008, Ignacio Donati wrote:
> Quick question to the wisdom of the community... I am not very experience with objects, and I was
> wondering where will be the right place to define my own smarty functions...
>
> My goal is to have something similar to the sample from the smarty documentation...:
>
> <?php
> $smarty->register_function('date_now', 'print_current_date');
>
> function print_current_date($params, &$smarty)
> {
> if(empty($params['format'])) {
> $format = "%b %e, %Y";
> } else {
> $format = $params['format'];
> }
> return strftime($format,time());
> }
> ?>
> And in the template call the function...
>
> {date_now}
>
> {* or to format differently *}
> {date_now format="%Y/%m/%d"}
>
>
> but I am not sure how/where to connect the php part of the code...
>
> Any help is highly appreciated!!!
> Thanks...
> Ignacio
>
>
--
Jon Daley
http://jon.limedaley.com
~~
I wish there were a knob on the TV to turn up the intelligence.
There's a knob called "brightness," but that doesn't work.
More information about the pLog-general
mailing list