Taggable Behaviour how to create a link to a tag?

I use the Taggable Behaviour extension to add tags to my posts.

On my posts view page i want to display links to all tags belonging to this post.

Right now i have the following code to list the tags, but without links:


$tags = $model->buecher->getTags();


        echo CHtml::openTag('ul');

        foreach($tags as $tag){

            echo CHtml::openTag('li');

            echo $tag;

            echo CHtml::closeTag('li');

        }

        echo CHtml::closeTag('ul');

Now i want a link to each tags view page but don´t know how, because i get no id and can´t do this:


echo CHtml::link($tag, array('tag/view', 'id' => $hereTheIdIsNeeded ));

Please help. Thanks in advance.

HI

please check on echo ‘<pre>’; print_r($tags); May be you will get ID.

than for create link use Yii::app()->createUrl(controller name/ action view name, parameter - means id );

Thanks

Pravin Gajera

$tags is only an array of strings. As you can see i traverse trough this array and echo the tags. But there is no id there.

Help still needed.

Than may be your array is wrong

your don’t contain id than how you will retrieve it.

Thanks

Pravin Gajera