Location: PHPKode > projects > PHP Project Navigator > ppnav-0.1/smarty/plugins/function.get_generation_date.php
<?php
/**
 * @package PHP Project Navigator
 * @file function.get_generation_date.php
 * @copyright (C) 2006 Scott Brumbaugh
 * @license GPL Version 2 or later
 *
 * $Id: function.get_generation_date.php 11 2006-10-06 16:59:19Z brumbs $
 */


/**
 * @function smarty_function_get_generation_date
 * 
 * smarty template component that will assign the database 
 * generation date to the assigned template variable.
 *
 * @param params array containing the template variable key to be assigned
 * @param smarty reference to the smarty object
 *
 * Usage:
 *
 * {get_generation_date assign='gen_date'}
 *
 * generation date was {$gen_date|date_format}
 */
function smarty_function_get_generation_date($params, &$smarty) {

    global $dbh;
    
    $sql =<<<SQL_END
select generation_date from projects
SQL_END;

    $generation_date = $dbh->getOne($sql);
    if (PEAR::isError($generation_date)) {
       die($generation_date->getMessage());
    }	

    $smarty->assign($params[assign], $generation_date);
}

?>
Return current item: PHP Project Navigator