Getting a value from a database table dynamically
you could do something like that : 

public function showForumTopicsByCat($catId)
{
    $topic_model = $this-&gt;loadModel('Forum');
    $this-&gt;view-&gt;forum_topics = $topic_model-&gt;getForumTopics($catId);
    $this-&gt;view-&gt;render('forum/viewTopics');
}


and on view 

&lt;?php
if ($this-&gt;forum_categories) {
   for($i=o; $i &lt; $numberCat; $i++){
       echo '&lt;a href="'. URL . 'forum/showForumTopicsCat'.$i.'/"&gt;Category1&lt;/a&gt;';
    }
   } else {
    echo '&lt;p&gt;There are no categories.&lt;/p&gt;';
}
?&gt;