예제 #1
0
 public function showAction($key = false)
 {
     $key = $key ? $key : Route::current()->uri();
     if ($key == "/") {
         $key = config('laikacms.default.baseroute');
     }
     //if(\Cache::has($key)){
     //    return \Cache::get($key);
     // }
     $content = \KSPM\LCMS\Model\Page::where('slug', '=', $key)->first();
     if (!$content) {
         $content = \KSPM\LCMS\Model\Content::where('key', '=', 'error.pagecontent.notfound')->first();
     }
     $renderResult = \View::make('pages::show', array('content' => Compiler::init($content)->compile()))->render();
     ob_start();
     eval('$page=$content;$cmsprefix=_LCMS_PREFIX_; ?>' . $renderResult . '<?php ');
     return ob_get_clean();
 }
예제 #2
0
파일: Page.php 프로젝트: ksp-media/laikacms
 public static function htmlTree()
 {
     $page = new self();
     return '<ol class="dd-list">' . $page->_getTreeData(Page::where('parent', '=', 0)->orderBy('position')->get()) . '</ol>';
 }
예제 #3
0
 private function _parseUseTemplateTag()
 {
     $this->_findSections('final');
     $pattern = '/@use\\(\'(.*?)\'\\)/is';
     preg_match_all($pattern, $this->_template, $result, PREG_SET_ORDER);
     if (count($result) > 0) {
         foreach ($result as $r) {
             $this->_template = \KSPM\LCMS\Model\Page::where('slug', '=', $r[1])->first()->template;
             break;
         }
     }
     $this->_findSections('before');
     $this->_mergeSections();
     $this->_renderedTags = $this->_template;
 }
예제 #4
0
 private function _updateTreeItemPosition($childs, $parentId)
 {
     $pos = 0;
     foreach ($childs as $item) {
         \KSPM\LCMS\Model\Page::find($item['id'])->update(['position' => $pos, 'parent' => $parentId]);
         if (key_exists('children', $item)) {
             $this->_updateTreeItemPosition($item['children'], $item['id']);
         }
         $pos++;
     }
 }