コード例 #1
0
 private function getDetailTpl($tpl)
 {
     $tplPath = CommonUtility::getThemePath(['page', $tpl]);
     if (TFileHelper::exist($tplPath)) {
         return $tpl;
     }
     return 'detail_default';
 }
コード例 #2
0
ファイル: ContentAction.php プロジェクト: dw250100785/lulucms
 public function getTpl($chnId, $tplType)
 {
     $ret = TFileHelper::buildPath(['model_default', str_replace('_tpl', '_default', $tplType)]);
     $cachedChannels = LuLu::getAppParam('cachedChannels');
     if (isset($cachedChannels[$chnId])) {
         $channelModel = $cachedChannels[$chnId];
         $table = $channelModel['table'];
         $tplName = $channelModel[$tplType];
         $tplPath = CommonUtility::getThemePath(['content', $table, $tplName]);
         if (TFileHelper::exist($tplPath)) {
             $ret = TFileHelper::buildPath([$table, $tplName]);
         } else {
             LuLu::info($tplPath . ' does not exist', __METHOD__);
         }
     }
     return $ret;
 }
コード例 #3
0
ファイル: ContentAction.php プロジェクト: liangdabiao/lulucms
 public function getTpl($chnId, $tplName)
 {
     $ret = TFileHelper::buildPath(['model_default', $tplName], false);
     $cachedChannels = LuLu::getAppParam('cachedChannels');
     if (isset($cachedChannels[$chnId])) {
         $backend = \Yii::getAlias('@backend');
         $channelModel = $cachedChannels[$chnId];
         $table = $channelModel['table'];
         $tplPath = TFileHelper::buildPath([$backend, 'views', 'content', $table, $tplName . '.php'], false);
         if (TFileHelper::exist($tplPath)) {
             $ret = TFileHelper::buildPath([$table, $tplName], false);
         } else {
             LuLu::info($tplPath . ' does not exist in backend', __METHOD__);
         }
     }
     return $ret;
 }
コード例 #4
0
ファイル: CommonUtility.php プロジェクト: hucongyang/lulucms2
 public static function getFiles($dir = null, $prefix = null, $isBack = null)
 {
     $root = '';
     if ($isBack === null) {
         $root = \Yii::getAlias('@webroot');
     } else {
         if ($isBack) {
             $root = \Yii::getAlias('@backend');
         } else {
             $root = \Yii::getAlias('@frontend');
         }
     }
     if ($dir !== null) {
         if (is_string($dir)) {
             $pathArray = [$root, $dir];
         } else {
             if (is_array($dir)) {
                 $pathArray = array_merge([$root], $dir);
             }
         }
     } else {
         $pathArray = [$root];
     }
     return TFileHelper::getFiles($pathArray, $prefix);
 }
コード例 #5
0
ファイル: CacheUtility.php プロジェクト: hucongyang/lulucms2
 private static function writeFile($fileName, $content)
 {
     $rootData = \Yii::getAlias('@data');
     TFileHelper::writeFile([$rootData, 'cache', $fileName], $content);
 }
コード例 #6
0
ファイル: TplManager.php プロジェクト: merlinxie/lulublog
 public static function createChannelCache()
 {
     $newLine = "\r\n";
     $content = '<?php' . $newLine;
     $dataList = Channel::_getChannelArrayTree(0, 0);
     foreach ($dataList as $row) {
         $id = $row['id'];
         $parentIds = Channel::getParentIds($id);
         $childrenIds = Channel::getChildrenIds($id);
         $leafIds = Channel::getLeafIds($id);
         $content .= '$cachedChannels[' . $row['id'] . ']=[' . $newLine;
         $content .= self::getCacheItem('id', $row, 'int');
         $content .= self::getCacheItem('parent_id', $row, 'int');
         $content .= self::getCacheItemValue('parent_ids', implode(',', $parentIds));
         $content .= self::getCacheItemValue('children_ids', implode(',', $childrenIds));
         $content .= self::getCacheItemValue('leaf_ids', implode(',', $leafIds));
         $content .= self::getCacheItem('name', $row);
         $content .= self::getCacheItem('name_alias', $row);
         $content .= self::getCacheItem('name_url', $row);
         $content .= self::getCacheItem('redirect_url', $row);
         $content .= self::getCacheItem('level', $row, true);
         $content .= self::getCacheItem('is_leaf', $row, true);
         $content .= self::getCacheItem('is_nav', $row, true);
         $content .= self::getCacheItem('sort_num', $row, true);
         $content .= self::getCacheItem('table', $row);
         $content .= self::getCacheItem('channel_tpl', $row);
         $content .= self::getCacheItem('list_tpl', $row);
         $content .= self::getCacheItem('detail_tpl', $row);
         $content .= self::getCacheItem('page_size', $row, true);
         $content .= "];" . $newLine;
     }
     $rootData = \Yii::getAlias('@data');
     TFileHelper::writeFile([$rootData, 'cache', 'cachedChannels.php'], $content);
     return $content;
 }