Tags block in Page List
Permalink
Hi,
I've got a Page List acting as a blog index page.
In the Blog summaries, I'd like to pull in the applied Tags for that page, with the ability to click those tags and filter down. Basically I need to add the Tags Block to Page List custom template.
I've found the following way to embed the block programmatically, but how on earth can you pass in the CID?
I've got a Page List acting as a blog index page.
In the Blog summaries, I'd like to pull in the applied Tags for that page, with the ability to click those tags and filter down. Basically I need to add the Tags Block to Page List custom template.
I've found the following way to embed the block programmatically, but how on earth can you pass in the CID?
$bt_main = BlockType::getByHandle('tags'); $bt_main->controller->displayMode = 'page'; $bt_main->controller->cloudCount = 0; $bt_main->render();
this is the code you're looking for (I wrapped mine in a p class called Meta):
Viewing 15 lines of 41 lines. View entire code block.
Thanks Cannon.
I ended up finding a way that was somewhat similar;
I ended up finding a way that was somewhat similar;
Loader::model('attribute/categories/collection'); $ak = CollectionAttributeKey::getByHandle('tags'); $akID = $ak->akID; $parentPagePath = $c->getCollectionPath(); $selectedOptions = $cobj->getAttribute($ak->getAttributeKeyHandle()); //var_dump($selectedOptions); if($selectedOptions->count() > 0) { echo '<p class="tags">'; $len = $selectedOptions->count(); $i=1; foreach($selectedOptions as $opt) { echo '<a href="'.$parentPagePath.'/?akID['.$akID.'][atSelectOptionID][]='.$opt->ID.'">'.ucfirst($opt->value).'</a>'; echo $i<$len ? ', ' : ''; $i++; }
Viewing 15 lines of 17 lines. View entire code block.