How to get the current page's Topic(s) inside the Page List template?
Permalink
How to get the current page's Topic(s) inside the Page List template? I'm trying to auto-redirect a page to a topic's landing page, so I need to get the URL of the topic assigned to the current page.
I've tried copying code from the topic list module, but it always comes out empty, even though I know that the page in question has a topic assigned.
I tried the following, but it didn't work -- please help! Running 5.7.5.2.
I've tried copying code from the topic list module, but it always comes out empty, even though I know that the page in question has a topic assigned.
I tried the following, but it didn't work -- please help! Running 5.7.5.2.
<?php $topics = $c->getAttribute($this->topicAttributeKeyHandle); if (count($topics)) { ?> <ul class="ccm-block-topic-list-page-topics"> <?php foreach($topics as $topic) { ?> <li><a href="<?php echo $view->controller->getTopicLink($topic)?>"><?php echo $topic->getTreeNodeDisplayName()?></a></li> <?php } ?> </ul> <?php } else { ?> <?php echo t('No topics.')?> <?php } ?>