本文整理汇总了PHP中common\models\Category::getCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getCategories方法的具体用法?PHP Category::getCategories怎么用?PHP Category::getCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\Category
的用法示例。
在下文中一共展示了Category::getCategories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetCategories
public function testGetCategories()
{
$categories = $this->categoryModel->getCategories();
foreach ($categories->models as $category) {
$this->assertInstanceOf('common\\models\\Category', $category);
}
}
示例2: actionView
/**
* Просмотр списка постов по тегу
* @param $id
* @return string
*/
public function actionView($id)
{
$tagModel = new Tags();
$tag = $tagModel->getTag($id);
$categoryModel = new Category();
return $this->render('view', ['tag' => $tag, 'posts' => $tag->getTagPosts(), 'categories' => $categoryModel->getCategories()]);
}
示例3: actionIndex
/**
* Список постов.
* @return string
*/
public function actionIndex()
{
$post = new Post();
$category = new Category();
return $this->render('index', ['posts' => $post->getPublishedPosts(), 'categories' => $category->getCategories()]);
}
示例4: init
public function init()
{
parent::init();
$this->categoryArr = Category::getCategories();
}
示例5: actionView
public function actionView($id)
{
$categoryModel = new Category();
$category = $categoryModel->getCategory($id);
return $this->render('index', ['category' => $category, 'posts' => $category->getPosts(), 'categories' => $categoryModel->getCategories()]);
}