<input type="hidden" name="a" value="search"/>
        <input type="text" name="q" class="search" placeholder="<?php 
echo __('Search our knowledge base');
?>
"/>
        <input type="submit" style="display:none" value="search"/>
        </form>
    </div>
    <div class="content">
        <section>
            <div class="header"><?php 
echo __('Help Topics');
?>
</div>
<?php 
foreach (Topic::objects()->annotate(array('faqs_count' => SqlAggregate::count('faqs')))->filter(array('faqs_count__gt' => 0)) as $t) {
    ?>
        <div><a href="?topicId=<?php 
    echo urlencode($t->getId());
    ?>
"
            ><?php 
    echo $t->getFullName();
    ?>
</a></div>
<?php 
}
?>
        </section>
        <section>
            <div class="header"><?php 
?>
</div>
</div>
</div>

<div class="span4">
    <div class="sidebar">

    <div class="content">
        <section>
            <div class="header"><?php 
//echo __('Help Topics');
?>
</div>
<?php 
foreach (Topic::objects()->filter(array('faqs__faq__category__category_id' => $category->getId())) as $t) {
    ?>
        <a href="?topicId=<?php 
    echo urlencode($t->getId());
    ?>
"
            ><?php 
    echo $t->getFullName();
    ?>
</a>
<?php 
}
?>
        </section>
    </div>
    </div>
<?php 
} else {
    echo __('NO FAQs found');
}
?>
</div>
<div class="span4">
    <div class="sidebar">
    <div class="searchbar">
        <form method="get" action="faq.php">
        <input type="hidden" name="a" value="search"/>
        <select name="topicId"  style="width:100%;max-width:100%"
            onchange="javascript:this.form.submit();">
            <option value="">— Browse by Topic —</option>
<?php 
$topics = Topic::objects()->annotate(array('has_faqs' => SqlAggregate::COUNT('faqs')))->filter(array('has_faqs__gt' => 0));
foreach ($topics as $T) {
    ?>
        <option value="<?php 
    echo $T->getId();
    ?>
"><?php 
    echo $T->getFullName();
    ?>
</option>
<?php 
}
?>
        </select>
        </form>
    </div>