当前位置: 首页>>代码示例>>PHP>>正文


PHP Catalog::getParantsCatalog方法代码示例

本文整理汇总了PHP中Catalog::getParantsCatalog方法的典型用法代码示例。如果您正苦于以下问题:PHP Catalog::getParantsCatalog方法的具体用法?PHP Catalog::getParantsCatalog怎么用?PHP Catalog::getParantsCatalog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Catalog的用法示例。


在下文中一共展示了Catalog::getParantsCatalog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $model = $this->controller->loadModel();
     if (isset($_POST['Soft'])) {
         $model->attributes = $_POST['Soft'];
         //封面、图标、 文件
         $model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
         $model->soft_icon = isset($_POST['soft_icon']) ? $_POST['soft_icon'] : '';
         $model->soft_file = isset($_POST['soft_file']) ? $_POST['soft_file'] : '';
         //摘要
         $model->introduce = trim($_POST['Soft']['introduce']) ? $_POST['Soft']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Soft']['content']), 200);
         //标签   (前5个标签有效)
         $tags = trim($_POST['Soft']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         $model->update_time = time();
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Update Success'), $this->controller->createUrl('index'));
         }
     }
     $parents = Catalog::getParantsCatalog($model->catalog_id);
     $catalog = Catalog::model()->findByPk($model->catalog_id);
     $belong = $catalog ? implode('>', $parents) . '>' . $catalog->catalog_name : '';
     $this->controller->render('update', array('model' => $model, 'parents' => $belong));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:26,代码来源:UpdateAction.php

示例2: run

 public function run()
 {
     $catalog_id = trim(Yii::app()->request->getParam('catalog_id'));
     $order = trim(Yii::app()->request->getParam('order'));
     if (!$order) {
         $order = 'id';
     }
     switch ($order) {
         case 'id':
             $order_by = 't.id DESC';
             break;
         case 'view_count':
             $order_by = 'view_count DESC';
             break;
         default:
             $order = 'id';
             $order_by = 't.id DESC';
             break;
     }
     //SEO
     $navs = array();
     $search_cats = '所有';
     if ($catalog_id) {
         $condition = ' AND catalog_id = ' . $catalog_id;
         $catalog = Catalog::model()->findByPk($catalog_id);
         if ($catalog) {
             $this->controller->_seoTitle = $catalog->seo_title ? $catalog->seo_title : $catalog->catalog_name . ' - ' . $this->controller->_setting['site_name'];
             $this->controller->_seoKeywords = $catalog->seo_keywords;
             $this->controller->_seoDescription = $catalog->seo_description;
             $navs[] = array('url' => $this->controller->createUrl('image/index', array('catalog_id' => $catalog->id)), 'name' => $catalog->catalog_name);
             //已搜索的分类
             $cat_parents = Catalog::getParantsCatalog($catalog_id);
             $search_cats = $cat_parents ? implode('>', $cat_parents) . '>' . $catalog->catalog_name : $catalog->catalog_name;
         }
     }
     if (!$navs) {
         $condition = '';
         $catalog = array();
         $seo = ModelType::getSEO('image');
         $this->controller->_seoTitle = $seo['seo_title'] . ' - ' . $this->controller->_setting['site_name'];
         $this->controller->_seoKeywords = $seo['seo_keywords'];
         $this->controller->_seoDescription = $seo['seo_description'];
         $navs[] = array('url' => Yii::app()->request->getUrl(), 'name' => $this->controller->_seoTitle);
     }
     //获取所有符合条件的图集
     $pages = array();
     $datalist = Image::model()->getList(array('condition' => $condition, 'limit' => 15, 'order' => $order_by, 'page' => true), $pages);
     //该栏目下最新的图集
     $last_images = Image::model()->getList(array('condition' => $condition, 'limit' => 10));
     $this->controller->render('index', array('navs' => $navs, 'catalog' => $catalog, 'datalist' => $datalist, 'pagebar' => $pages, 'last_images' => $last_images, 'order' => $order, 'search_cats' => $search_cats));
 }
开发者ID:manjingzi,项目名称:yiifcms,代码行数:51,代码来源:IndexAction.php


注:本文中的Catalog::getParantsCatalog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。