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?

$bt_main = BlockType::getByHandle('tags'); 
$bt_main->controller->displayMode = 'page';
$bt_main->controller->cloudCount = 0;
$bt_main->render();

moth
 
cannonf700 replied on at Permalink Reply
cannonf700
this is the code you're looking for (I wrapped mine in a p class called Meta):
<p class="meta">Tags:
    <?php   
      $ak_t = CollectionAttributeKey::getByHandle('tags'); 
      $tag_list = $cobj->getCollectionAttributeValue($ak_t);
      $akc = $ak_t->getController();
   if(method_exists($akc, 'getOptionUsageArray')){
      //$tags == $tag_list->getOptions();
         foreach($tag_list as $akct){
            $qs = $akc->field('atSelectOptionID') . '[]=' . $akct->getSelectAttributeOptionID();
            echo '<a  class="tags" href="'.$BASE_URL.$search.'?'.$qs.'">'.$akct->getSelectAttributeOptionValue().'</a>';
               echo ' | ';
         }
   }else{
      for ($i = 0; $i < count($cArray); $i++ ) {
         if ($cobj->getCollectionDatePublic() < date('Y-m-d H:i:s') ){
moth replied on at Permalink Best Answer Reply
moth
Thanks Cannon.
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++;
                }