function __get($var) { //allows smarty to invoke function as if getter $classname = get_class($this); $method = 'get' . ucfirst($var); if (method_exists($classname, $method)) { return $this->{$method}(); } else { return parent::__get($var); } }