Hi could someone please shed some light on this for me…
I’m using a PageList to add article numbers to a TopicList Block, however when i’m logged in it works as expected, when i’m logged out the PageList count is -1?
foreach ($node->getChildNodes() as $topic) {
$pl = new \Concrete\Core\Page\PageList();
$pl->filterByPageTypeHandle('news');
$pl->filterByTopic($topic);
$count = $pl->getTotalResults();
if ($count >= 1) {
if ($topic instanceof \Concrete\Core\Tree\Node\Type\Category) {
?><li><span></span><span><?php echo $topic->getTreeNodeDisplayName(); ?></span>
<?php
} else {
?><li><a href="<?php echo $controller->getTopicLink($topic); ?>" <?php
if (isset($selectedTopicID) && $selectedTopicID == $topic->getTreeNodeID()) {
?> class="ccm-block-topic-list-topic-selected"<?php
}
?>><span><i class="uil uil-tag"></i></span><span><?php echo $topic->getTreeNodeDisplayName(); ?> <span class="badge bg-secondary rounded-pill"><?php echo $count; ?></span></span></a><?php
}
if (count($topic->getChildNodes())) {
$walk($topic);
} ?>
</li>
<?php
}
}