function smarty_resource_framework_get_file($tpl_name) { $module = null; if (preg_match('/\\+/', $tpl_name)) { list($module, $tpl_name) = explode('+', $tpl_name); } return Framework_Template::getPath($tpl_name, $module) . '/' . $tpl_name; }
/** * display * * @access public * @return void */ public function display() { $path = Framework_Template::getPath($this->module->tplFile, Framework::$request->module); $this->template->assign('modulePath', $path); $this->template->assign('site', Framework::$site); $this->template->assign('tplFile', $this->module->tplFile); $this->template->assign('user', $this->user); $this->template->assign('session', $this->session); foreach ($this->module->getData() as $var => $val) { if (!in_array($var, array('path', 'tplFile'))) { $this->template->assign($var, $val); } } if ($this->module->pageTemplateFile == null) { $pageTemplateFile = 'page.tpl'; } else { $pageTemplateFile = $this->module->pageTemplateFile; } $this->template->display($pageTemplateFile); }
/** * __construct * * @access public * @param object $module Instance of Framework_Module to be displayed * @return void */ public function __construct(Framework_Module $module) { parent::__construct($module); $this->template = Framework_Template::factory('Smarty', Framework::$request->module); }
/** * setPaths * * @access public * @param string $template * @return void */ protected function setPaths($template) { $this->template_dir = Framework_Template::getPath($template, $this->module, $this->template); $path = realpath(Framework::$site->getPath() . '/Templates/' . $this->template); $this->compile_dir = $path . '/templates_c'; $this->cache_dir = $path . '/cache'; $this->config_dir = $path . '/config'; $this->plugins_dir = array_merge($this->plugins_dir, array('Framework/Template/Smarty/plugins', 'plugins', $path . '/plugins')); if (!is_writeable($this->compile_dir) || !is_writeable($this->cache_dir)) { throw new Framework_Exception('Cannot write to template cache/compile dirs: ' . $path); } }
/** * smarty_function_framework_pager * * @author Joe Stump <*****@*****.**> * @param array $params * @param object $smarty * @package Framework * @subpackage Template */ function smarty_function_framework_pager($params, &$smarty) { $required = array('start', 'limit', 'total'); foreach ($required as $r) { if (!isset($params[$r])) { $smarty->trigger_error("framework_pager: missing '{$r}' parameter"); } } extract($params); if ($total <= $imit) { return true; } $pageTotal = $pages > 0 ? $pages : 10; // Prep the URL string we use. We can't keep "start" in the URL because // it will confuse scripts. if ($params['url']) { $url = $params['url']; } else { $url = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; } $sets = array(); foreach ($_GET as $key => $val) { if ($key == 'start') { continue; } if (strlen($key) && strlen($val)) { if (!ereg($key . "=", $_SERVER['PATH_INFO']) && !eregi('\\?', $val)) { if (is_array($val)) { for ($i = 0; $i < count($val); ++$i) { $sets[] = $key . '[]=' . $val[$i]; } } else { $sets[] = $key . '=' . $val; } } } } $s = '?'; if (count($sets)) { $url .= '?' . implode('&', $sets); $s = '&'; } // Only output if we have more than one page to show $nav =& new Framework_Pager(); $nav->start = $start; $nav->limit = $limit; $nav->total = $total; $nav->pages = $pageTotal; if ($start + $limit > $total) { $stop = $total; } else { $stop = $start + $limit; } $tpl = Framework_Template::factory('Smarty', 'Framework'); $tpl->assign('nav', $nav); $tpl->assign('params', $params); $tpl->assign('stop', $stop); $tpl->assign('s', $s); $tpl->assign('url', $url); $tpl->display('framework_pager.tpl'); }