Quote:
Originally Posted by jvancamp
This is an awesome add on. I got it installed and working great. I do have a question for other users of this add on.
Does anyone know if there is a way to show the newest ad's say the last 3 or 4 on the home page of a VbAvanced website? Similar to the Newest column shown in the classifieds screen showing the little picture of the item.
|
I think that it should works. Paste the code in a file and name it as_you_want.php Upload it to vBa modules directory and then from your AdminCP choose: vBa CMPS->Add Module->PHP File and setup it as:
Module Title : Anything you want to appear as title
Column : Left or Right for side modules, Center for Central modules.
Display order : Better let it blank
Active : YES
Update all pages : It's up to you
File to include : From the droplist choose the right file
Template used : Let it blank
Module Parent : None
Identifier : A good way is to write the file name without ".php"
Clean File Output :
YES
Use Module Shell Template : YES
Module Link : Let it blank
Title Row Colspan : Let it blank
Form Code : Let it blank
Usergroups: It's up to you
Quote:
<?
$categories = $db->query_read("SELECT id, name FROM ".TABLE_PREFIX."classifieds_categories ORDER BY displayorder");
$condfield = "categoryid";
$do = "category";
$whatid = "catid";
$columns = intval($vbulletin->options["classifieds_catlistingcolumns"]);
$adsnumber = intval($vbulletin->options["classifieds_catlistingadspercategory"]);;
$html = '';
$count = 0;
$col = 0;
$now = time();
if($db->num_rows($categories) != 0) {
$html = '<table width="100%">';
while($cat = $db->fetch_array($categories)) {
if($col == 0)
$html .= '<tr>';
$title = sanitize_title($cat["name"]);
$adslisting = '';
$ads = $db->query_read("
SELECT id, title
FROM ".TABLE_PREFIX."classifieds_ads
WHERE $condfield=".$cat["id"]." AND active=1 AND hidden=0 AND approved=1
AND publishdate<=$now AND (expirationdate=0 OR expirationdate>$now)
ORDER BY publishdate DESC, activateddate DESC LIMIT $adsnumber");
while($ad = $db->fetch_array($ads)) {
$adtitle = sanitize_title($ad["title"]);
eval('$adslisting .= "' . fetch_template('classifieds_categorieslistingadlin e') . '";');
}
if($db->num_rows($ads) == 0)
$adslisting = '<tr><td><div align="center" class="smallfont">'.$vbphrase["classifieds_no_ads_in_category"].
"<a href=\"classifieds.php?do=editad&$whatid=".$cat['id']."\">".$vbphrase["classifieds_post_your_now"]."</a>".'</div>';
eval('$html .= "' . fetch_template('classifieds_categorieslistingblock ') . '";');
$col++;
if($col == $columns) {
$html .= '</tr>';
$col = 0;
}
$count++;
}
if($col != 0 && $count > 0)
$html .= '</tr>';
$html .= '</table>';
}
?>
|