diff --git a/page.php b/page.php index 4836041fe..2d4eee764 100644 --- a/page.php +++ b/page.php @@ -65,9 +65,7 @@ else $e107CorePage->setPage(); require_once(HEADERF); - - echo $e107CorePage->pageOutput['text']; - + e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage'); require_once(FOOTERF); exit; } @@ -288,10 +286,10 @@ class pageClass } - - /** - * Parse the Book/Chapter "listChapters' template + * Parse the Book/Chapter "listChapters' template + * @param int $book + * @return array */ function listChapters($book=1) { @@ -342,7 +340,7 @@ class pageClass if($sql->select("page_chapters", "*", "chapter_parent = ".intval($book)." AND chapter_visibility IN (".USERCLASS_LIST.") ORDER BY chapter_order ASC ")) { - $text .= $tp->simpleParse($template['start'],$bvar); + $text = $tp->simpleParse($template['start'],$bvar); while($row = $sql->fetch()) { @@ -386,7 +384,9 @@ class pageClass /** - * Handle Chapter Icon Glyphs. + * Handle Chapter Icon Glyphs. + * @param $icon + * @return null|string */ private function chapterIcon($icon) { @@ -394,7 +394,7 @@ class pageClass if(!vartrue($icon)) { - return; + return null; } if($glyph = $tp->toGlyph($icon)) @@ -435,7 +435,7 @@ class pageClass if($row['chapter_meta_keywords']) define('META_KEYWORDS', eHelper::formatMetaKeys($row['chapter_meta_keywords'])); } - $bookId = $row['chapter_parent']; + //$bookId = $row['chapter_parent']; $bookSef = $this->getSef($row['chapter_parent']); $bookTitle = $this->getName($row['chapter_parent']); @@ -482,14 +482,14 @@ class pageClass $pageArray = $sql->db_getList(); $header = $tp->simpleParse($template['start'],$var); - $text .= $tp->parseTemplate($header,true); // for parsing {SETIMAGE} etc. + $text = $tp->parseTemplate($header,true); // for parsing {SETIMAGE} etc. foreach($pageArray as $page) { - $data = array( + /*$data = array( 'title' => $page['page_title'], 'text' => $tp->toHtml($page['page_text'],true) - ); + );*/ $page['chapter_sef'] = $this->getSef($page['page_chapter']); // $chapter_sef; $page['book_sef'] = $bookSef; @@ -534,7 +534,7 @@ class pageClass LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_id=".intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later - + if(!$sql->gen($query)) @@ -712,7 +712,6 @@ class pageClass { if(null !== $this->cacheData) { - return $this->renderCache(); } if(true === $this->authorized) @@ -721,19 +720,25 @@ class pageClass $vars = $this->batch->getParserVars(); $template = str_replace('{PAGECOMMENTS}', '[[PAGECOMMENTS]]', $this->template['start'].$this->template['body'].$this->template['end']); - $ret = $this->renderPage($template); + $arr = $this->renderPage($template); if(!empty($this->template['page'])) { - $ret = str_replace(array('{PAGE}', '{PAGECOMMENTS}'), array($ret, '[[PAGECOMMENTS]]'), $this->template['page']); + $ret = str_replace(array('{PAGE}', '{PAGECOMMENTS}'), array($arr['text'], '[[PAGECOMMENTS]]'), $this->template['page']); } + else + { + $ret = $arr['text']; + } + $ret = e107::getParser()->parseTemplate($ret, true, $this->batch); if($vars->cachecontrol) $this->setCache($ret, $this->batch->sc_cpagetitle(), $this->page['page_comment_flag']); //return str_replace('[[PAGECOMMENTS]]', $this->batch->cpagecomments(), $ret); - $this->pageOutput = array('text' => str_replace('[[PAGECOMMENTS]]', $this->batch->cpagecomments(), $ret)); - return; + $this->pageOutput = array('text' => str_replace('[[PAGECOMMENTS]]', $this->batch->cpagecomments(), $ret), 'caption'=>$arr['caption'],'mode'=>$arr['mode']); + + return null; } $extend = new e_vars; @@ -778,7 +783,8 @@ class pageClass } // return $this->renderPage($template, $extend); - $this->pageOutput = array('text' => $this->renderPage($template, $extend)); + $tmp = $this->renderPage($template, $extend); + $this->pageOutput = array('text' => $tmp['text'], 'caption'=>$tmp['caption'], 'mode'=>$tmp['mode']); } public function renderPage($template, $vars = null) @@ -802,7 +808,9 @@ class pageClass $mode = vartrue($this->template['tableRender'], 'cpage-page-view'); } - return e107::getRender()->tablerender($this->page['page_title'], $ret, $mode, true); + return array('caption'=>$this->page['page_title'], 'text'=>$ret, 'mode'=>$mode); + + // return e107::getRender()->tablerender($this->page['page_title'], $ret, $mode, true); //table style not parsed in hearder yet. }