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