Thread: Major Additions - Classifieds
View Single Post
  #99  
Old 02-22-2009, 04:12 PM
MaryTheG(r)eek MaryTheG(r)eek is offline
 
Join Date: Sep 2006
Location: Greece
Posts: 1,340
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jvancamp View Post
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>';
}
?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01108 seconds
  • Memory Usage 1,780KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete