I have the article hack (vb2) on my site, and wanted to include '5 latest articles' on the vbhome lite page. I can't seem to get it to work though, and was hoping someone could tell me what I'm missing.
This is the PHP I added to the index.php. Its based on the '10 latest threads':
PHP Code:
// +--------------------------------------------------------------
// | Latest KB Articles
// +--------------------------------------------------------------
$kbheader = '';
$kbbits = '';
{
eval( '$kbheader = "' . gettemplate( 'home_kbheader' ) . '";' );
$kbart = $DB_site->query("
SELECT artid, categoryid,date, title, hits, author
FROM vbArticles_content
WHERE categoryid != 7 AND categoryid != 8
ORDER BY artid DESC LIMIT 5
");
while ( $kbart = $DB_site->fetch_array( $kbart ) )
{
eval( '$kbbits .= "' . gettemplate( 'home_kbbit' ) . '";' );
}
$DB_site->free_result( $kbart );
unset( $kbart );
}
As you can tell this uses 2 templates, a header and a bit that displays the info for the article. The query works, I've tested it and it gives me the 5 latest additions, leaving out anything from category 7 or 8.
The index however only gives me the single latest addition, not 5. The kbbit template is:
PHP Code:
<tr class="clfirst">
<td><img src="{imageshome}/arrow.gif" alt="" class="imgborder" height="7" width="7" border="0"/><a href="$bburl/articles.php?action=viewarticle&artid=$kbart[artid]"><span class="txtbold">$kbart[title]</span></a><br />
Added: $kbart[date]<br>
Author: $kbart[author]</a><br>
Views: $kbart[hits]</td>
</tr>
Nothing I can see that's wrong here. So why doesn't it display 5? The query works, the template works, but together it doesn't...
help?