Ir para conteúdo
Fórum Script Brasil

arroutban

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre arroutban

arroutban's Achievements

0

Reputação

  1. Galera, seguinte, baixei esse script (http://www.bosdev.com/bosclassifieds/), e to fazendo vários testes. o que eu queria era que na página index.php, na lista de classificados, aparecesse também junto com o titulo, a descrição e o preço os campos ad_optional_1, ad_optional_2 e ad_optional_3 da tabela bclass_ads (que são campos adicionais relacionados a tabela bclass_categories: category_optional_1, category_optional_2, category_optional_3). No arquivo classified.php ele mostra os 3 campos adicionais. tabela bclass_ads: ad_id ad_status 1 ad_user_id 1 ad_category 1 ad_date_begin ad_date_end ad_type ad_title ad_description ad_image1 ad_image2 ad_image3 ad_image4 ad_image5 ad_options ad_optional_1 980 ad_optional_2 São Paulo ad_optional_3 Santana ad_optional_4 ad_optional_5 ad_price ad_condition ad_views tabela bclass_categories: category_id category_order 1 category_parent category_title Alugar category_desc category_img category_ad_types 1 category_optional_1 Referência nº category_optional_2 Cidade category_optional_3 Bairro category_optional_4 category_optional_5 category_price_sale category_price_want category_price_job category_price_service category_price_notice _______________________________________________________________________________ _______________________________________________________________________________ index.php <?php //Connect to database & get functions loaded include("connect.php"); include("functions.php"); //Set globals global $SystemOptions,$cat_id; $result = query("SELECT * FROM {$class_prefix}system",$class_link); $SystemOptions = mysql_fetch_array($result); //Check for spider-friendly URL if(isset($PATH_INFO) && $SystemOptions['spider'] == 1) { $parts = explode('/', substr($PATH_INFO,1)); for($i=0; $i < count($parts); $i++){ if($i % 2 == 0){ $$parts[$i] = $parts[$i+1];} } } //Set language include("{$SystemOptions['main_path']}languages/{$SystemOptions['language']}.php"); //Check for expired ads expireAds(); //Set some defaults and do some protection if($cat_id == "") { $cat_id = 0; $title_extra = $Languages['nav']['home']; } else { $cat_id = protect($cat_id); $result = query("SELECT category_title FROM {$class_prefix}categories WHERE category_id=$cat_id",$class_link); list($cat_title) = mysql_fetch_row($result); $title_extra = stripslashes($cat_title); } if($pg == "") { $pg = 1; } include("header.php"); $ads_counter = 0; $imgs = array(); $ads = array(); $result = query("SELECT ad_id,ad_date_begin,ad_date_end,ad_type,ad_title,ad_description,ad_image1,ad_options,ad_price FROM {$class_prefix}ads WHERE ad_status=1 AND ad_category=$cat_id $sort_text",$class_link); while(list($ad_id,$ad_date_begin,$ad_date_end,$ad_type,$ad_title,$ad_description,$ad_image1,$ad_options,$ad_price) = mysql_fetch_row($result)) { $ad_title = stripslashes($ad_title); $ad_description = stripslashes($ad_description); if(strlen($ad_description) >= 50) { $ad_description = substr($ad_description,0,50)."..."; } if($ad_image1 != "") { if($SystemOptions['spider'] == 1) { $imgs[$ads_counter] = "<a href=\"{$SystemOptions['main_url']}classified.php/ad/$ad_id\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad_id}_1_thumb.jpg\" border=\"2\" class=\"ad_thumb\"></a>"; } else { $imgs[$ads_counter] = "<a href=\"{$SystemOptions['main_url']}classified.php?ad=$ad_id\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad_id}_1_thumb.jpg\" border=\"2\" class=\"ad_thumb\"></a>"; } } if($ad_price == "0.00") { $ad_price = $Languages['index']['bestoffer']; } else { $ad_price = formatPrice($ad_price); } switch($ad_type) { case 1: $type = "<b>{$Languages['index']['forsale']}</b>"; $price = "<br><span style=\"font-weight:bold;\">{$Languages['index']['price_sale']}</span>$ad_price&nbsp;&nbsp;"; break; case 2: $type = "<b>{$Languages['index']['wanted']}</b>"; $price = "<br><span style=\"font-weight:bold;\">{$Languages['index']['price_want']}</span>$ad_price&nbsp;&nbsp;"; break; case 4: $type = "<b>{$Languages['index']['job']}</b>"; $price = ""; break; case 8: $type = "<b>{$Languages['index']['service']}</b>"; $price = ""; break; case 16: $type = "<b>{$Languages['index']['notice']}</b>"; $price = ""; break; } $date = formatDate($ad_date_begin); if($SystemOptions['spider'] == 1) { $ads[$ads_counter] = "{$type} <a href=\"{$SystemOptions['main_url']}classified.php/ad/$ad_id\" class=\"ad_link\"><span style=\"font-weight:bold;\">$ad_title</span></a><br>$ad_description<br>{$price}"; } else { $ads[$ads_counter] = "{$type} <a href=\"{$SystemOptions['main_url']}classified.php?ad=$ad_id\" class=\"ad_link\"><span style=\"font-weight:bold;\">$ad_title</span></a><br>$ad_description<br>{$price}"; } if($ad_options != 0) { $back = ""; $back_e = ""; $bold = ""; $bold_e = ""; $italic = ""; $italic_e = ""; if(($ad_options & 8) != 0) { $back = "<div class=\"background_1\">"; $back_e = "</div>"; } if(($ad_options & 16) != 0) { $back = "<div class=\"background_2\">"; $back_e = "</div>"; } if(($ad_options & 32) != 0) { $back = "<div class=\"background_3\">"; $back_e = "</div>"; } if(($ad_options & 64) != 0) { $back = "<div class=\"background_4\">"; $back_e = "</div>"; } if(($ad_options & 2) != 0) { $bold = "<span style=\"font-weight:bold;\">"; $bold_e = "</span>"; } if(($ad_options & 4) != 0) { $italic = "<span style=\"font-style:italic;\">"; $italic_e = "</span>"; } $ads[$ads_counter] = "{$back}<span class=\"ad_text\">{$bold}{$italic}{$ads[$ads_counter]}{$italic_e}{$bold_e}</span>{$back_e}"; } $ads_counter++; } if($ads_counter != 0) { echo $sort_table; echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" class=\"menu_bar\"><tr><td class=\"menu_bar_text\">{$Languages['index']['results']}</td></tr></table>"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"; for($i=(($pg*6)-6); $i<=(($pg*6)-1); $i++) { if($ads[$i] == "") { continue; } echo "<tr>"; if($imgs[$i] != "") { echo " <td valign=\"top\" width=\"50\" class=\"ad\">$imgs[$i]</td>"; echo " <td valign=\"top\" class=\"ad\"><span class=\"ad_text\">$ads[$i]</span></td>"; } else { echo " <td valign=\"top\" class=\"ad\" colspan=\"2\"><span class=\"ad_text\">$ads[$i]</span></td>"; } echo "</tr>"; } echo "</table>"; if($ads_counter > 6) { echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"; echo "<tr><td align=\"right\" class=\"category_text\">{$Languages['index']['gotopage']} "; $pages = ceil($ads_counter/6); for($i=1; $i<=$pages; $i++) { if($pg == $i) { echo "{$i}&nbsp;"; } else { if($SystemOptions['spider'] == 1) { echo "<a href=\"{$SystemOptions['main_url']}index.php/cat_id/$cat_id/pg/$i/sort/$sort/sort_dir/$sort_dir\">{$i}</a>&nbsp;"; } else { echo "<a href=\"{$SystemOptions['main_url']}index.php?cat_id=$cat_id&pg=$i&sort=$sort&sort_dir=$sort_dir\">{$i}</a>&nbsp;"; } } } echo "</td></tr></table>"; } } if($ads_counter == 0 && $cat_id != 0 && $category_counter == 0) { echo "<br><br><div class=\"ad_text\" align=\"center\">{$Languages['index']['noads']}</div><br><br>"; } ?> _______________________________________________________________________________ _______________________________________________________________________________ classified.php <?php //Connect to database & get functions loaded include("connect.php"); include("functions.php"); //Set globals global $SystemOptions,$cat_id; $result = query("SELECT * FROM {$class_prefix}system",$class_link); $SystemOptions = mysql_fetch_array($result); //Check for spider-friendly URL if(isset($PATH_INFO) && $SystemOptions['spider'] == 1) { $parts = explode('/', substr($PATH_INFO,1)); for($i=0; $i < count($parts); $i++){ if($i % 2 == 0){ $$parts[$i] = $parts[$i+1];} } } //Set language include("{$SystemOptions['main_path']}languages/{$SystemOptions['language']}.php"); //Get ad data $ad = protect($ad); $result = query("SELECT a.ad_status,a.ad_user_id,a.ad_category,a.ad_date_begin,a.ad_date_end,a.ad_type,a.ad_title,a.ad_description,a.ad_image1,a.ad_ image2,a.ad_image3,a.ad_image4,a.ad_image5,a.ad_options,a.ad_optional_1,a.ad_optional_2,a.ad_optional_3,a.ad_optional_4,a.ad _optional_5,a.ad_price,a.ad_condition,a.ad_views,c.category_optional_1,c.category_optional_2,c.category_optional_3,c.categor y_optional_4,c.category_optional_5,u.user_name FROM {$class_prefix}ads a LEFT JOIN {$class_prefix}categories c ON a.ad_category=c.category_id LEFT JOIN {$class_prefix}users u ON a.ad_user_id=u.user_id WHERE ad_id=$ad",$class_link); list($ad_status,$ad_user_id,$cat_id,$ad_date_begin,$ad_date_end,$ad_type,$ad_title,$ad_description,$ad_image1,$ad_image2,$ad _image3,$ad_image4,$ad_image5,$ad_options,$ad_optional_1,$ad_optional_2,$ad_optional_3,$ad_optional_4,$ad_optional_5,$ad_pri ce,$ad_condition,$ad_views,$category_optional_1,$category_optional_2,$category_optional_3,$category_optional_4,$category_opt ional_5,$username) = mysql_fetch_row($result); //Display header include("header.php"); //Add viewer to statistics recordUser("a",$ad); $ad_views++; $now = time(); if($ad_status != 1 || ($now > strtotime($ad_date_end) && $ad_date_end != "0000-00-00")) { echo "<span class=\"ad_text\"><br>{$Languages['classified']['sorry']}<br><br></span>"; } else { $ad_title = stripslashes($ad_title); $ad_description = toHtml($ad_description); $ad_optional_1 = stripslashes($ad_optional_1); $ad_optional_2 = stripslashes($ad_optional_2); $ad_optional_3 = stripslashes($ad_optional_3); $ad_optional_4 = stripslashes($ad_optional_4); $ad_optional_5 = stripslashes($ad_optional_5); $category_optional_1 = stripslashes($category_optional_1); $category_optional_2 = stripslashes($category_optional_2); $category_optional_3 = stripslashes($category_optional_3); $category_optional_4 = stripslashes($category_optional_4); $category_optional_5 = stripslashes($category_optional_5); $username = stripslashes($username); $ad_date_begin = formatDate($ad_date_begin); if($ad_date_end != "0000-00-00") { $ad_date_end = formatDate($ad_date_end); $end_date = "<b>{$Languages['classified']['ends']}:</b> $ad_date_end<br>"; } if($ad_price == "0.00") { $ad_price = $Languages['classified']['bestoffer']; } else { $ad_price = formatPrice($ad_price); } switch($ad_type) { case 1: $type = $Languages['classified']['forsale']; $pricetype = $Languages['classified']['asking']; $condtype = $Languages['classified']['condition']; break; case 2: $type = $Languages['classified']['wanted']; $pricetype = $Languages['classified']['offering']; $condtype = $Languages['classified']['desired_condition']; break; case 4: $type = $Languages['classified']['job']; break; case 8: $type = $Languages['classified']['service']; break; case 16: $type = $Languages['classified']['notice']; break; } $ad_condition = $Languages['classified']["cond".$ad_condition]; if($category_optional_1 != "") { $optional_line .= "<b>$category_optional_1:</b> $ad_optional_1<br>"; } if($category_optional_2 != "") { $optional_line .= "<b>$category_optional_2:</b> $ad_optional_2<br>"; } if($category_optional_3 != "") { $optional_line .= "<b>$category_optional_3:</b> $ad_optional_3<br>"; } if($category_optional_4 != "") { $optional_line .= "<b>$category_optional_4:</b> $ad_optional_4<br>"; } if($category_optional_5 != "") { $optional_line .= "<b>$category_optional_5:</b> $ad_optional_5<br>"; } if($optional != "") { $optional_line .= "<br>"; } if($_COOKIE['bc_userID'] != "" && authenticate($_COOKIE['bc_userID'])) {} elseif($_COOKIE['bc_userID'] == $ad_user_id) {} else { $admin_bar = ""; } $imgs = 0; if($ad_image1 != "") { $imgs++; } if($ad_image2 != "") { $imgs++; } if($ad_image3 != "") { $imgs++; } if($ad_image4 != "") { $imgs++; } if($ad_image5 != "") { $imgs++; } if($imgs != 0) { $image_layout = "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">"; $image_layout .= "<tr>"; $image_layout .= "<td width=\"75%\" valign=\"center\"><img src=\"{$SystemOptions['main_url']}images/ads/$ad_image1\" name=\"mainPicture\" width=\"{$SystemOptions['max_size']}\"></td>"; $image_layout .= "<td width=\"25%\" valign=\"center\">"; if($ad_image1 != "") { $image_layout .= "<a href=\"java script:update('{$SystemOptions['main_url']}images/ads/$ad_image1');\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad}_1_thumb.jpg\" width=\"80\"></a><br><br>"; } if($ad_image2 != "") { $image_layout .= "<a href=\"java script:update('{$SystemOptions['main_url']}images/ads/$ad_image2');\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad}_2_thumb.jpg\" width=\"80\"></a><br><br>"; } if($ad_image3 != "") { $image_layout .= "<a href=\"java script:update('{$SystemOptions['main_url']}images/ads/$ad_image3');\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad}_3_thumb.jpg\" width=\"80\"></a><br>"; } if($ad_image4 != "") { $image_layout .= "<a href=\"java script:update('{$SystemOptions['main_url']}images/ads/$ad_image4');\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad}_4_thumb.jpg\" width=\"80\"></a><br>"; } if($ad_image5 != "") { $image_layout .= "<a href=\"java script:update('{$SystemOptions['main_url']}images/ads/$ad_image5');\"><img src=\"{$SystemOptions['main_url']}images/ads/{$ad}_5_thumb.jpg\" width=\"80\"></a><br>"; } $image_layout .= "</td></tr></table>"; } if($ad_type == 1 || $ad_type == 2) { $price_line = "<b>$pricetype:</b> $ad_price<br>"; $condition_line = "<b>$condtype:</b> $ad_condition<br>"; } echo<<<ENDPRINT <script language=JavaScript"> <!-- function update(url){ document['mainPicture].src=url; return; } //--> </script> <br> $admin_bar <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td class="ad_text" width="50%" valign="top"> <b>$type $ad_title</b><br> <hr> $price_line $optional_line <hr> <b>{$Languages['classified']['description']}:</b><br> $ad_description<br><br> <a href="java script:history.go(-1)">voltar</a> </td> <td class="ad_text" width="50%" valign="top"> $image_layout<br /> </td> </tr> </table> ENDPRINT; } ?> __________________________________________________________________________________ __________________________________________________________________________________
×
×
  • Criar Novo...