本文整理匯總了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]);
}
}
示例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]);
}
}