Created
July 19, 2015 11:23
-
-
Save katzueno/f7deb2e62eed645bbe0b to your computer and use it in GitHub Desktop.
Display the number of the pages with a particular topic value in concrete5.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 5.6 の場合 | |
Loader::model('page_list'); | |
$pl = new PageList(); | |
$pl->filterByAttribute('attr_name','attr_value','like'); | |
echo $pl->getTotal(); | |
// 5.7 でトピック属性 | |
// /application/blocks/topic_list/view.php | |
// クラスを読み込み | |
$pageList = new \Concrete\Core\Page\PageList(); | |
// 以下をループ | |
$pagesOfATopic = $pageList->filterByTopic($topic); // ここ | |
$result = $pageList->getTotalResults($pagesOfATopic); | |
echo $result; // ここでそのトピックを持っているページの数を出力 | |
// 他に使えるオプション | |
/* | |
filterByPageTypeHandle(); | |
filterByPageTemplate(); | |
filterByDateAdded(); | |
filterByNumberOfChildren(); | |
filterByUserID($uID); | |
filterByPageTypeID($ptID); | |
filterByParentID($cParentID); | |
filterByName($name, $exact = false); | |
filterByKeywords($keywords) | |
filterByFulltextKeywords($keywords); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment