Пример #1
0
 public static function get_instance($have_db = true)
 {
     if (self::$instance == NULL) {
         self::$instance = new SilkSmarty($have_db);
     }
     return self::$instance;
 }
Пример #2
0
/**
 * Returns a reference to the global smarty object.  Replaces
 * the global $gCms; $config =& $gCms->GetSmarty() routine.
 */
function smarty()
{
    return SilkSmarty::get_instance();
}
Пример #3
0
 /**
  * Getter overload method.  Called when an $obj->field and field
  * does not exist in the object's variable list.  In this case,
  * it will get a db or smarty instance (for backwards 
  * compatibility), or call get on the given field name.
  *
  * @param string The field to look up
  * @return mixed The value for that field, if it exists
  * @author Ted Kulp
  **/
 function __get($name)
 {
     if ($name == 'db') {
         return SilkDatabase::get_instance();
     } else {
         if ($name == 'smarty') {
             return SilkSmarty::get_instance();
         } else {
             return $this->get($name);
         }
     }
 }