/** * @param string $tplFile */ protected function fetch($tplFile) { if (DAGGER_TEMPLATE_ENGINE === 'smarty') { $tpl = new BaseViewSmarty(); } else { $tpl = new BaseView(); } $tpl->assign($this->view); return trim($tpl->fetch($tplFile)); }
/** * 构造翻页字符串 * @return string 返回翻页页码html代码 */ public function getPageStr() { if (DAGGER_TEMPLATE_ENGINE === 'smarty') { $tpl = new BaseViewSmarty(); } else { $tpl = new BaseView(); } $assign = array('totalPage' => $this->totalPage, 'pageSize' => $this->pageSize, 'prePage' => $this->prePage, 'nextPage' => $this->nextPage, 'firstPage' => $this->firstPage, 'lastPage' => $this->lastPage, 'totalNum' => $this->totalNum, 'pName' => $this->pName, 'page' => $this->page, 'paramStr' => $this->paramStr); $format = isset($_REQUEST['format']) ? $_REQUEST['format'] : ''; switch ($format) { case 'xml': case 'json': return !$this->totalPage ? array() : $assign; break; default: foreach ($assign as $key => $val) { $tpl->assign($key, $val); } $style = intval($this->style); return !$this->totalPage ? '' : $tpl->fetch('page/style_' . $style . '.html'); } }