本文整理汇总了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]);
}
}