當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Category::getPartions方法代碼示例

本文整理匯總了PHP中common\models\Category::getPartions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::getPartions方法的具體用法?PHP Category::getPartions怎麽用?PHP Category::getPartions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common\models\Category的用法示例。


在下文中一共展示了Category::getPartions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionCategory

 public function actionCategory($id)
 {
     $category = Category::findOne(['id' => $id]);
     if ($category === NULL) {
         throw new NotFoundHttpException("Категория {$id} не найдена");
     }
     $this->getView()->title = "Mexanika 74 - Запчасти: категория " . $category->name;
     //return $this->render('category_item', ['category'=>$category]);
     if (!Category::findOne(['parent_id' => $category->id])) {
         $dataProvider = new ActiveDataProvider(['query' => $category->getParts()]);
         return $this->render('list', ['dataProvider' => $dataProvider, 'category' => $category]);
     } else {
         $partions = Category::getPartions($category->id);
         return $this->render('index', ['partions' => $partions]);
     }
 }
開發者ID:phpsong,項目名稱:ExtJS5-Yii2,代碼行數:16,代碼來源:PartController.php

示例2: actionCatalog

 public function actionCatalog($id = null)
 {
     if ($id) {
         $categories = Category::findAll(['parent_id' => $id]);
         if ($categories === NULL) {
             throw new NotFoundHttpException("Категория {$id} не найдена");
         }
         $oneLevelCategory = Category::findOne(['id' => $id]);
         $this->getView()->title = "Mexanika 74 - Каталог техники: " . $oneLevelCategory->name . " - " . \common\components\Htmlhelper::getMetaList($categories);
         return $this->render('catalog', ['categories' => $categories, 'oneLevelCategory' => $oneLevelCategory]);
     } else {
         //получить разделы у "Каталог техники"
         $partions = Category::getPartions(Category::TECHNICS_ID);
         //получить все категории, входящие в разделы
         $oneLvl = Category::getFirstLevel(Category::TECHNICS_ID);
         $this->getView()->title = "Mexanika 74 - Каталог техники: " . \common\components\Htmlhelper::getMetaList($partions);
         return $this->render('catalog', ['categories' => $oneLvl, 'parents' => $partions]);
     }
 }
開發者ID:phpsong,項目名稱:ExtJS5-Yii2,代碼行數:19,代碼來源:SiteController.php


注:本文中的common\models\Category::getPartions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。