Does anybody know how to display the latest advertisements on the forum home page ?
I've tried creating a plugin with the following -
PHP Code:
$newads_get = $vbulletin->db->query_read("
SELECT classified.classifiedid AS classifiedid, classified.categoryid AS categoryid, classified.userid AS userid,
classified.dateline AS dateline, classified.timeframe AS timeframe, classified.title AS title, classified.price AS price,
classified.type AS type, user.*,
upload.classifiedid, upload.image AS image
FROM " . TABLE_PREFIX . "sr_classifieds AS classified
LEFT JOIN " . TABLE_PREFIX . "sr_classifieds_uploads AS upload ON (upload.classifiedid=classified.classifiedid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid=classified.userid)
ORDER BY dateline DESC
LIMIT $newadlimit
");
while($newad = $vbulletin->db->fetch_array($newads_get)){
$newad[dateline] = vbdate($vbulletin->options['dateformat'], $newad['dateline'], '', '');
eval('$newadbit .= "' . fetch_template('sr_classifieds_newadbit') . '";');
}
I enabled that under the forumhome_start hook and then added
PHP Code:
<table cellpadding="5" cellspacing="$stylevar[sellcellspacing]" width="100%" >
<tr><td colspan="7" class="thead">$vbphrase[sr_classifieds_recent_ads]</td></tr>
<tr>
$newadbit</tr>
</table>
In my FORUMHOME template but i get an SQL error. What am i doing wrong ?