Results 1 to 2 of 2

Thread: Eliminate Feature listings from {random_listings_horizontal}

  1. #1
    Join Date
    Jun 2010
    Posts
    6

    Question Eliminate Feature listings from {random_listings_horizontal}

    Hi,

    I want to eliminate feature listings from {random_listings_horizontal} results.

    I fount in listing.inc.php the code that I belive is the one who create {random_listings_horizontal} results, amount others, but I can't figure out how to filter feature listings to be include.

    Any help will be appreciate.

    PHP Code:
    function renderFeaturedListings($num_of_listings 0$template_name '',$random=FALSE,$pclass='')
        {
            global 
    $conn$lang$config$db_type;
            
    //Load the Core Template class and the Misc Class
            
    require_once($config['basepath'] . '/include/class/template/core.inc.php');
            
    $page = new page_user();
            require_once(
    $config['basepath'] . '/include/misc.inc.php');
            
    $misc = new misc();
            
    //Declare an empty display variable to hold all output from function.
            
    $display '';
            
    //Get the number of listing to display by default, unless user specified an override in the template file.
            
    if ($num_of_listings == 0) {
                
    $num_of_listings $config['num_featured_listings'];
            }
            
    //Load a Random set of featured listings
            
    if ($db_type == 'mysql') {
                
    $rand 'RAND()';
            }else {
                
    $rand 'RANDOM()';
            }
            if(
    $random == TRUE){
                
    $sql_rand '';
            }else{
                
    $sql_rand "(listingsdb_featured = 'yes') AND";
            }
            if (
    $config['use_expiration'] === "1") {
                if (
    $pclass != '') {
                
    $sql "SELECT " $config['table_prefix'] . "listingsdb.listingsdb_id, listingsdb_title FROM " $config['table_prefix'] . "listingsdb," $config['table_prefix_no_lang'] . "classlistingsdb WHERE $sql_rand (listingsdb_active = 'yes') AND (listingsdb_expiration > " $conn->DBDate(time()) . ") AND (" $config['table_prefix'] . "listingsdb.listingsdb_id = " $config['table_prefix_no_lang'] . "classlistingsdb.listingsdb_id) AND class_id = " $pclass " ORDER BY $rand";
                } else {
                
    $sql "SELECT " $config['table_prefix'] . "listingsdb.listingsdb_id, listingsdb_title FROM " $config['table_prefix'] . "listingsdb WHERE $sql_rand (listingsdb_active = 'yes') AND (listingsdb_expiration > " $conn->DBDate(time()) . ") ORDER BY $rand";
                }
            }else {
                if (
    $pclass != '') {
                
    $sql "SELECT " $config['table_prefix'] . "listingsdb.listingsdb_id, listingsdb_title FROM " $config['table_prefix'] . "listingsdb," $config['table_prefix_no_lang'] . "classlistingsdb WHERE $sql_rand (listingsdb_active = 'yes') AND (" $config['table_prefix'] . "listingsdb.listingsdb_id = " $config['table_prefix_no_lang'] . "classlistingsdb.listingsdb_id) AND class_id = " $pclass " ORDER BY $rand";
                } else {
                
    $sql "SELECT " $config['table_prefix'] . "listingsdb.listingsdb_id, listingsdb_title FROM " $config['table_prefix'] . "listingsdb WHERE $sql_rand (listingsdb_active = 'yes') ORDER BY $rand";
                }
            }
            
    $recordSet $conn->SelectLimit($sql$num_of_listings0);
            if (
    $recordSet === false) {
                
    $misc->log_error($sql);
            }
            
    //Find out how many listing were returned
            
    $returned_num_listings $recordSet->RecordCount();
            if (
    $returned_num_listings >= 1) {
    //Load the Featured Listing Template specified in the Site Config unless a template was specified in the calling template tag.
                
    if ($template_name == '') {
                    
    $page->load_page($config['template_path'] . '/' $config['featured_listing_template']);
                }else {
                    
    $page->load_page($config['template_path'] . '/featured_listing_' $template_name '.html');
                }

    // Determine if the template uses rows.
    // First item in array is the row conent second item is the number of block per block row
                
    $featured_template_row $page->get_template_section_row('featured_listing_block_row');
                if (
    is_array($featured_template_row)) {
                    
    $row $featured_template_row[0];
                    
    $col_count $featured_template_row[1];
                    
    $user_rows true;
                    
    $x 1;
    //Create an empty array to hold the row conents
                    
    $new_row_data = array();
                }else {
                    
    $user_rows false;
                }
                
    $featured_template_section '';
                while (!
    $recordSet->EOF) {
                    if (
    $user_rows == true && $x $col_count) {
    //We are at then end of a row. Save the template section as a new row.
                        
    $new_row_data[] = $page->replace_template_section('featured_listing_block'$featured_template_section,$row);
    //$new_row_data[] = $featured_template_section;
                        
    $featured_template_section $page->get_template_section('featured_listing_block');
                        
    $x=1;
                    }else {
                        
    $featured_template_section .= $page->get_template_section('featured_listing_block');
                    }
                    
    $listing_title $misc->make_db_unsafe ($recordSet->fields['listingsdb_title']);
                    
    $ID $misc->make_db_unsafe ($recordSet->fields['listingsdb_id']);
                    if (
    $config['url_style'] == '1') {
                        
    $featured_url 'index.php?action=listingview&listingID=' $ID;
                    }else {
                        
    $url_title str_replace("/"""$listing_title);
                        
    $url_title strtolower(str_replace(" "$config['seo_url_seperator'], $url_title));
                        
    $featured_url 'listing-' urlencode($url_title) . '-' $ID '.html';
                    }
                    
    $featured_template_section $page->replace_listing_field_tags($ID$featured_template_section);
                    
    $featured_template_section $page->replace_listing_field_tags($ID$featured_template_section);
                    
    $featured_template_section $page->parse_template_section($featured_template_section'featured_url'$featured_url);
    // Setup Image Tags
                    
    $sql2 "SELECT listingsimages_thumb_file_name,listingsimages_file_name FROM " $config['table_prefix'] . "listingsimages WHERE (listingsdb_id = $ID) ORDER BY listingsimages_rank";
                    
    $recordSet2 $conn->SelectLimit($sql210);
                    if (
    $recordSet2 === false) {
                        
    $misc->log_error($sql2);
                    }
                    if (
    $recordSet2->RecordCount() > 0) {
                        
    $thumb_file_name $misc->make_db_unsafe ($recordSet2->fields['listingsimages_thumb_file_name']);
                        
    $file_name $misc->make_db_unsafe($recordSet2->fields['listingsimages_file_name']);
    // gotta grab the thumbnail image size
                        
    $imagedata GetImageSize("$config[listings_upload_path]/$thumb_file_name");
                        
    $imagewidth $imagedata[0];
                        
    $imageheight $imagedata[1];
                        
    $shrinkage $config['thumbnail_width'] / $imagewidth;
                        
    $featured_thumb_width $imagewidth $shrinkage;
                        
    $featured_thumb_height $imageheight $shrinkage;
                        
    $featured_thumb_src $config['listings_view_images_path'] . '/' $thumb_file_name;

    // gotta grab the thumbnail image size
                        
    $imagedata GetImageSize("$config[listings_upload_path]/$file_name");
                        
    $imagewidth $imagedata[0];
                        
    $imageheight $imagedata[1];
                        
    $featured_width $imagewidth;
                        
    $featured_height $imageheight;
                        
    $featured_src $config['listings_view_images_path'] . '/' $file_name;
                    }else {
                        if (
    $config['show_no_photo'] == 1) {
                            
    $imagedata GetImageSize("images/nophoto.gif");
                            
    $imagewidth $imagedata[0];
                            
    $imageheight $imagedata[1];
                            
    $shrinkage $config['thumbnail_width'] / $imagewidth;
                            
    $featured_thumb_width $imagewidth $shrinkage;
                            
    $featured_thumb_height $imageheight $shrinkage;
                            
    $featured_thumb_src "images/nophoto.gif";
                            
    $featured_width $featured_thumb_width;
                            
    $featured_height $featured_thumb_height;
                            
    $featured_src "images/nophoto.gif";
                        }else {
                            
    $featured_thumb_width '';
                            
    $featured_thumb_height '';
                            
    $featured_thumb_src '';
                            
    $featured_width '';
                            
    $featured_height '';
                            
    $featured_src '';
                        }
                    }
                    if (!empty(
    $featured_thumb_src)) {
                        
    $featured_template_section $page->parse_template_section($featured_template_section'featured_thumb_src'$featured_thumb_src);
                        
    $featured_template_section $page->parse_template_section($featured_template_section'featured_thumb_height'$featured_thumb_height);
                        
    $featured_template_section $page->parse_template_section($featured_template_section'featured_thumb_width'$featured_thumb_width);
                        
    $featured_template_section $page->cleanup_template_block('featured_img'$featured_template_section);
                    }else {
                        
    $featured_template_section $page->remove_template_block('featured_img'$featured_template_section);
                    }
                    if (!empty(
    $featured_src)) {
                                    
    $featured_template_section $page->parse_template_section($featured_template_section'featured_large_src'$featured_src);
                                    
    $featured_template_section $page->parse_template_section($featured_template_section'featured_large_height'$featured_height);
                                    
    $featured_template_section $page->parse_template_section($featured_template_section'featured_large_width'$featured_width);
                                    
    $featured_template_section $page->cleanup_template_block('featured_img_large'$featured_template_section);
                    }else {
                                    
    $featured_template_section $page->remove_template_block('featured_img_large'$featured_template_section);
                    }

                    
    $recordSet->MoveNext();
                    if (
    $user_rows == true) {
                        
    $x++;
                    }
                }
                if (
    $user_rows == true) {
                    
    $featured_template_section $page->cleanup_template_block('featured_listing'$featured_template_section);
                    
    $new_row_data[] = $page->replace_template_section('featured_listing_block'$featured_template_section,$row);
                    
    $replace_row '';
                    foreach (
    $new_row_data as $rows){
                        
    $replace_row .= $rows;
                    }
                    
    $page->replace_template_section_row('featured_listing_block_row'$replace_row);
                }else {
                    
    $page->replace_template_section('featured_listing_block'$featured_template_section);
                }
                
    $page->replace_permission_tags();
                
    $display .= $page->return_page();
            }
            return 
    $display;
        } 

  2. #2
    Join Date
    Jun 2010
    Posts
    6

    Default Re: Eliminate Feature listings from {random_listings_horizontal}

    Any help will be appreciate.

Similar Threads

  1. Search page - want to eliminate a link
    By Hammer100 in forum Templates - Help/Ideas/Discussion
    Replies: 2
    Last Post: 06-28-2010, 12:07 PM
  2. Random_listings_horizontal with title and etc..
    By MCB in forum Installation/Configuration Help (CLOSED)
    Replies: 3
    Last Post: 10-18-2008, 02:55 PM
  3. How to eliminate ?PHPSESS... in the URL-s
    By XantosNew in forum General Help (CLOSED)
    Replies: 10
    Last Post: 09-17-2006, 05:40 AM
  4. Eliminate auto text wrap?
    By vinvalentino in forum General Help (CLOSED)
    Replies: 0
    Last Post: 08-10-2006, 04:53 PM
  5. Select the Feature Listings...say Feature Villas
    By webvivre in forum General Help (CLOSED)
    Replies: 3
    Last Post: 05-19-2006, 12:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •