Fork me on GitHub

smarty_function_datetime request  Bottom

  • could allowing an assign from this function be added to the core build? I end up writing a secondary plugin to do this alot of time. Unless there is already a better work around?
  • Not quite sure what you mean - could you elaborate a little...

    -Mark

    --
    Visit My homepage and Zikula themes.
  • certainly. Currently this pnrender plugin doesn't support returning the datetime back to an assign variable it returns back for display only. Manytimes I need a timestamp back for a query or display etc having the option to put it into a variable gives more flexibility in what can be done with it. All that needs to be done is a. The following changes would give this flexibility.

    Code

    function smarty_function_datetime($params, &$smarty)
    {
        extract($params);
        unset($params);
       
        // set some defaults
        if (!isset($format)) {
            $format = '_DATETIMEBRIEF';
        }
        if (strpos($format, '%') !== false) { // allow the use of conversion specifiers
            $mytime = ml_ftime($format, (GetUserTime(time())));
        } else {
            $mytime = ml_ftime(constant($format), (GetUserTime(time())));
        }
        if (isset($assign)) {
            $smarty->assign($assign, $mytime);
        } else {
            return $mytime;        
        }  
    }


    Found $smarty.now can be used to get the timestamp that I am looking for and can be passed to an assign so this accomplishes what I am looking for. The added functionality would still be nice though.

This list is based on users active over the last 60 minutes.