Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
748 views
in Q2A Core by

As I cannot find a widget for the categories to reposition the categories on top, I have to use an advanced theme.

I failed to understand the qa functions for categories, maybe I am too stupid?

So that's why I built my own simple query. Maybe it will help you for your own projects:

/* LIST categories with counts */
if($this->template=='qa') {
    $this->output('<ul id="categories_top">');
    $queryCats = qa_db_query_sub('SELECT title,qcount,backpath FROM `^categories` GROUP BY title;');
    while( ($row = qa_db_read_one_assoc($queryCats,true)) !== null ) {
        $this->output('<li><a href="'.$row['backpath'].'">'.$row['title'].' <span class="count">('.$row['qcount'].')</span></a></li>');
    }
    $this->output('</ul>');
}

 

Q2A version: 1.6.2
by
Wonderful and thanks a lot for sharing valuable code.. just curios to know if this code render correctly sub-categories too...! ??
by
I have no subcategories, so I could not test it :) but I think you need extra lines of code to implement it. By the way, here is the recent implementation: http://www.klaustukai.lt/
by
moved by
this code will add where? in which file?

Please log in or register to answer this question.

...