Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: how can I ajust listing browse.php like this ?

  1. #21
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    77

    Default

    Ok I have worked it out - the answer has been staring at me the whole time, I just needed to look at the code more deeper, and since this is within the existing code and others have requested the answer - here is the secret

    In style.php there are three functions being;

    renderSingleListingItem (line 222)
    renderSingleListingItemRaw (line 291)
    renderSingleListingItemNoCaption (line 314)

    Now within listing_browse.php where all the html code is for the page (can't give line numbers as I have quite a few edits from the original), all I have done is recreate the table for the listing and added in the tags of the fields where I wanted them (with a little reformatting of the table layout) - (sorry can not give example yet as its for a client site that does not yet want to let others see the site)

    e.g. the code is

    Code:
    <? renderSingleListingItemNoCaption&#40;$listingID=$current_ID, "status"&#41; ?>
    Note I have added that $listingID=$current_ID to ensure it gets the data for each specific record n the browse listing.

    The best part also is that you do not have to set the field up as yes to browse - which is cool.

    Now because I did not want the old table format I have commented out the sections I did not want, for me that was from;

    Code:
    // grab the rest of the listing's data
    to

    Code:
    //		&#125; // end while
    just before

    Code:
    echo "</tr>";
    	// deal with text areas, like descriptions
    What you do is up to you.

    Obviously I have done quite a bit of edits along the way but if you know your html and a little basic php - like me - then you should be able to go from there, the only thing you need to be careful of for formatting is to decide which one of the above 'renders' you want to use - descriptions of what each one does is within the style.php file.

    Anyway hope this helps you all that want it - it works for me and this just adds to my already excellent view of OR - great script guys - Donation will be on its way soon

    Greg

  2. #22
    Join Date
    Jan 2003
    Posts
    201

    Default

    You know what I just realized from reading your post. I'm still using a version where listingbrowse and listingsearch are reversed, so I was giving you answer for wrong page. DOH. :?

  3. #23
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    77

    Default

    That's fine it works for listing_search as well

    But that explains why I could not understand what you were trying to explain - no matter got it working now

    Greg

  4. #24
    Join Date
    Dec 2002
    Posts
    1,883

    Default

    Quote Originally Posted by gwmbox
    ), all I have done is recreate the table for the listing and added in the tags of the fields where I wanted them (with a little reformatting of the table layout) - (sorry can not give example yet as its for a client site that does not yet want to let others see the site)

    e.g. the code is

    Code:
    <? renderSingleListingItemNoCaption&#40;$listingID=$current_ID, "status"&#41; ?>
    Note I have added that $listingID=$current_ID to ensure it gets the data for each specific record n the browse listing.

    The best part also is that you do not have to set the field up as yes to browse - which is cool.

    Greg
    Could you please show me exactly how to add a new column with Price tag? I've been trying for hours but it can't figure out.
    Here is my Listing_browse.php's TABLE ( from line 439 OR 1 Reloaded 1.14

    Code:
    &#91;?>
    
    			<table border="<?php echo $style&#91;form_border&#93; ?>" cellspacing="<?php echo $style&#91;form_cellspacing&#93; ?>" cellpadding="<?php echo $style&#91;form_cellpadding&#93; ?>" width="<?php echo $style&#91;admin_table_width&#93; ?>" class="form_main" align="center">
    				<tr>
    					 <?php
    						if  &#40;&#40;$sortby == "listingname"&#41; ||&#40;$sortby == ""&#41;&#41;
    						&#123;
    							$sorttypestring = "sorttype=$sorttype&amp;amp;";
    						&#125;
    					?>
    
    					<?php
    					// grab browsable fields
    					$sql = "SELECT field_caption, field_name FROM " . $config&#91;table_prefix&#93; . "listingsFormElements WHERE &#40;display_on_browse = 'Yes'&#41; AND &#40;field_type <> 'textarea'&#41;AND &#40;field_name='Price'&#41;ORDER BY rank";
    					$recordSet = $conn->Execute&#40;$sql&#41;;
    					$num_columns = $recordSet->RecordCount&#40;&#41;;
    					// Add Title as a search link
    					$field_caption = "Title";
    					$field_name = "listingname";
    					if &#40;$sortby != $field_name&#41;
    					&#123;
    						$sorttypestring = "";
    					&#125;
    					else
    					&#123;
    						$sorttypestring = "sorttype=$sorttype&amp;amp;";
    					&#125;
    						echo "<td align=\"center\"><b><a href=\"$PHP_SELF?sortby=$field_name&amp;amp;$sorttypestring$guidestring\">$field_caption</a></b></td>";
    
    					while &#40;!$recordSet->EOF&#41;
    					&#123;
    						$field_caption = make_db_unsafe &#40;$recordSet->fields&#91;field_caption&#93;&#41;;
    						$field_name = make_db_unsafe &#40;$recordSet->fields&#91;field_name&#93;&#41;;
    						if &#40;$sortby != "'$field_name'"&#41;
    						&#123;
    							$sorttypestring = "";
    						&#125;
    						else
    						&#123;
    							$sorttypestring = "sorttype=$sorttype&amp;amp;";
    						&#125;
    						echo "<td align=\"center\"><b><a href=\"$PHP_SELF?sortby=$field_name&amp;amp;$sorttypestring$guidestring\">$field_caption</a></b></td>";
    						$recordSet->MoveNext&#40;&#41;;
    					&#125; // end while
    					$num_columns = $num_columns + 1; // add one for the image
    					?>
    				</tr>
    				<tr>
    					<td colspan="<?php echo $num_columns ?>">
    						<hr>
    					</td>
    				</tr>
    
    				<?php
    				$count = 0;
    				while &#40;!$resultRecordSet->EOF&#41;
    				&#123;
    					// alternate the colors
    					if &#40;$count == 0&#41;
    					&#123;
    						$count = $count +1;
    					&#125;
    					else
    					&#123;
    						$count = 0;
    					&#125;
    
    					$Title = make_db_unsafe &#40;$resultRecordSet->fields&#91;Title&#93;&#41;;
    					$current_ID = $resultRecordSet->fields&#91;ID&#93;;
    					echo "<tr><td align=\"left\" class=\"search_row_$count\" colspan=\"$num_columns\"><b><a href=\"listingview.php?listingID=$current_ID\">$Title</a></b></td></tr>";
    					echo "<tr>";
    
    					// grab the listing's image
    					$sql2 = "SELECT thumb_file_name FROM " . $config&#91;table_prefix&#93; . "listingsImages WHERE listing_id = $current_ID ORDER BY rank";
    					$recordSet2 = $conn->SelectLimit&#40;$sql2, 1, 0&#41;;
    					if &#40;$recordSet2 === false&#41;
    					&#123;
    						log_error&#40;$sql2&#41;;
    					&#125;
    					$num_images = $recordSet2->RecordCount&#40;&#41;;
    					if &#40;$num_images == 0&#41;
    					&#123;
    						if &#40;$config&#91;show_no_photo&#93; == "yes"&#41;
    						&#123;
    							//echo "<td class=\"search_row_$count\" align=\"center\"><img src=\"images/nophoto.gif\" border=\"1\" alt=\"no photo\"></td>";
    							echo "<td class=\"search_row_$count\" align=\"center\"><a href=\"listingview.php?listingID=$current_ID\"><img src=\"images/nophoto.gif\" border=\"1\" alt=\"no photo\"></a></td>";
    						&#125;
    						else
    						&#123;
    							echo "<td class=\"search_row_$count\">&amp;nbsp;</td>";
    						&#125;
    					&#125;
    					while &#40;!$recordSet2->EOF&#41;
    					&#123;
    						$thumb_file_name = make_db_unsafe &#40;$recordSet2->fields&#91;thumb_file_name&#93;&#41;;
    						if &#40;$thumb_file_name != ""&#41;
    						&#123;
    							// gotta grab the image size
    							$imagedata = GetImageSize&#40;"$config&#91;listings_upload_path&#93;/$thumb_file_name"&#41;;
    							$imagewidth = $imagedata&#91;0&#93;;
    							$imageheight = $imagedata&#91;1&#93;;
    							$shrinkage = $config&#91;thumbnail_width&#93;/$imagewidth;
    							$displaywidth = $imagewidth * $shrinkage;
    							$displayheight = $imageheight * $shrinkage;
    							echo "<td class=\"search_row_$count\" align=\"center\"><a href=\"listingview.php?listingID=$current_ID\">";
    							echo "<img src=\"$config&#91;listings_view_images_path&#93;/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\" alt=\"$thumb_file_name\"></a></td>";
    						&#125; // end if &#40;$thumb_file_name != ""&#41;
    						$recordSet2->MoveNext&#40;&#41;;
    					&#125; // end while
    
    					// grab the rest of the listing's data
    					$sql2 = "SELECT " . $config&#91;table_prefix&#93; . "listingsDBElements.field_value, " . $config&#91;table_prefix&#93; . "listingsFormElements.field_type FROM " . $config&#91;table_prefix&#93; . "listingsDBElements, " . $config&#91;table_prefix&#93; . "listingsFormElements WHERE &#40;&#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.listing_id = $current_ID&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsFormElements.display_on_browse = 'Yes'&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsFormElements.field_type <> 'textarea'&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.field_name = " . $config&#91;table_prefix&#93; . "listingsFormElements.field_name&#41;&#41; ORDER BY " . $config&#91;table_prefix&#93; . "listingsFormElements.rank";
    					$recordSet2 = $conn->Execute&#40;$sql2&#41;;
    						if &#40;$recordSet2 === false&#41;
    						&#123;
    							log_error&#40;$sql2&#41;;
    						&#125;
    					while &#40;!$recordSet2->EOF&#41;
    					&#123;
    					
    					      
    					     
    						$field_value = make_db_unsafe &#40;$recordSet2->fields&#91;field_value&#93;&#41;;
    						$field_type = make_db_unsafe &#40;$recordSet2->fields&#91;field_type&#93;&#41;;
    						echo "<td align=\"center\" class=\"search_row_$count\">";
    
    						if &#40;$field_type == "select-multiple" OR $field_type == "option" OR $field_type == "checkbox"&#41;
    						&#123;
    							// handle field types with multiple options
    
    							$feature_index_list = explode&#40;"||", $field_value&#41;;
    							while &#40;list&#40;$feature_list_Value, $feature_list_item&#41; = each &#40;$feature_index_list&#41;&#41;
    							&#123;
    								echo "$feature_list_item<br>";
    							&#125; // end while
    						&#125; // end if field type is a multiple type
    
    						elseif &#40;$field_type == "price"&#41;
    						&#123;
    							//$field_value = ereg_replace&#40;'&#91;^0-9&#93;', '', $field_value&#41;;
    							//echo "$config&#91;money_sign&#93;".number_format&#40;$field_value, 2, '.', ','&#41;;
    							$sql3 = "SELECT " . $config&#91;table_prefix&#93; . "listingsDBElements.field_value FROM " . $config&#91;table_prefix&#93; . "listingsDBElements, " . $config&#91;table_prefix&#93; . "listingsFormElements WHERE &#40;&#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.listing_id = $current_ID&#41; AND  &#40;" . $config&#91;table_prefix&#93; . "listingsFormElements.field_type <> 'textarea'&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.field_name = " . $config&#91;table_prefix&#93; . "listingsFormElements.field_name&#41;&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.field_name = 'status'&#41; ORDER BY " . $config&#91;table_prefix&#93; . "listingsFormElements.rank";
    							$recordSet3 = $conn->Execute&#40;$sql3&#41;;
    							if &#40;$recordSet3 === false&#41;
    							&#123;
    								log_error&#40;$sql3&#41;;
    							&#125;
    							$status = make_db_unsafe &#40;$recordSet3->fields&#91;field_value&#93;&#41;;
    							$recordSet3->Close&#40;&#41;;
    							$money_amount = international_num_format&#40;$field_value&#41;;
    							if &#40;$status == 'Sold'&#41;
    							&#123;
    								echo "<s>";
    								echo money_formats&#40;$money_amount&#41;;
    								echo "</s><br><span style=\"color&#58;red;\"><b>SOLD</b></span>";
    							&#125;
    							elseif &#40;$status == 'Pending'&#41;
    							&#123;
    								echo money_formats&#40;$money_amount&#41;;
    								echo "<br><span style=\"color&#58;green;\"><b>PENDING</b></span>";
    							&#125;
    							else
    							&#123;
    								echo money_formats&#40;$money_amount&#41;;
    							&#125;
    						&#125; // end elseif
    						elseif &#40;$field_type == "number"&#41;
    						&#123;
    							echo international_num_format&#40;$field_value&#41;;
    						&#125; // end elseif
    						elseif &#40;$field_type == "url"&#41;
    						&#123;
    							echo "<a href=\"$field_value\" target=\"_new\">$field_value</a>";
    						&#125;
    						elseif &#40;$field_type == "email"&#41;
    						&#123;
    							echo "<a href=\"mailto&#58;$field_value\">$field_value</a>";
    						&#125;
    						else
    						&#123;
    							echo "$field_value";
    						&#125; // end else
    
    						echo "</td>";
    						$recordSet2->MoveNext&#40;&#41;;
    					&#125; // end while
    
    
    					echo "</tr>";
    					// deal with text areas, like descriptions
    					$sql2 = "SELECT " . $config&#91;table_prefix&#93; . "listingsDBElements.field_value, " . $config&#91;table_prefix&#93; . "listingsFormElements.field_type FROM " . $config&#91;table_prefix&#93; . "listingsDBElements, " . $config&#91;table_prefix&#93; . "listingsFormElements WHERE &#40;&#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.listing_id = $current_ID&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsFormElements.display_on_browse = 'Yes'&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsFormElements.field_type = 'textarea'&#41; AND &#40;" . $config&#91;table_prefix&#93; . "listingsDBElements.field_name = " . $config&#91;table_prefix&#93; . "listingsFormElements.field_name&#41;&#41; ORDER BY " . $config&#91;table_prefix&#93; . "listingsFormElements.rank";
    					$recordSet2 = $conn->Execute&#40;$sql2&#41;;
    						if &#40;$recordSet2 === false&#41;
    						&#123;
    							log_error&#40;$sql2&#41;;
    						&#125;
    					while &#40;!$recordSet2->EOF&#41;
    					&#123;
    						$field_value = make_db_unsafe &#40;$recordSet2->fields&#91;field_value&#93;&#41;;
    						$field_caption = make_db_unsafe &#40;$recordSet2->fields&#91;field_caption&#93;&#41;;
    						$preview = substr&#40;$field_value, 0, 100&#41;;
    						echo "<tr><td colspan=\"$num_columns\" class=\"search_row_$count\">$preview";
                      		echo "... </font><b><font size=\"1\"><a href=\"listingview.php?listingID=$current_ID\">Read more.</a></font></b></td></tr>";
    
    
    
    						$recordSet2->MoveNext&#40;&#41;;
    					&#125; // end while
    
    
    					$resultRecordSet->MoveNext&#40;&#41;;
    				&#125; // end while
    
    
    				?>
    
    
    		</table>
    Thanks much!
    BJ

  5. #25
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    77

    Default

    If all you want is a new column you can just select the Price in the admin section within your Template Editor as Show on Browse equals yes - that will work

    But if you want the code to grab the price itself and use independantly for each listing and keep the number formmating you need to use the NoCaption option, the code for this is

    Code:
     <? renderSingleListingItemNoCaption&#40;$listingID=$current_ID, "price"&#41; ?>
    you just put this wherever you want the price to be shown.

    Now with the code you have provided well for me I commented it all out pretty much and started it all again to get my own look and feel, so it depends on what look you want in determining where you want the price to show up.

    Greg

  6. #26
    Join Date
    Dec 2002
    Posts
    1,883

    Default

    Thanks, I have been doing head miles for hours until I found this thread.

    a question though. I am trying to shorten the description string with no luck . Can anyone point out what I am doing wrong?

    in listingbrowse I have tried this with no luck at shortening the string -

    $shortdesc= renderSingleListingItemdesc($listingID=$current_ID , "full_desc");
    $shortdesc = substr($shortdesc, 0, 25);
    echo "$shortdesc";

    all its doing is pulling the whole description . even if I leave out echo "$shortdesc"; its still displays the whole description.

    Would really appreciate any help

  7. #27
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    77

  8. #28
    Join Date
    Dec 2002
    Posts
    1,883

    Default

    Great!
    Thanks

Similar Threads

  1. VOW NAR compliance
    By lostsoul in forum HELP (CLOSED)
    Replies: 2
    Last Post: 09-05-2004, 01:34 PM
  2. Features Listing By State or even city
    By ican in forum Feature Request (CLOSED)
    Replies: 4
    Last Post: 03-29-2004, 06:11 PM
  3. Couple questions... - ANSWERED
    By hbaker in forum HELP (CLOSED)
    Replies: 12
    Last Post: 11-12-2003, 12:42 AM
  4. Searching Within The Listing Editor?(Added 1.1.4)
    By mightybox in forum HELP (CLOSED)
    Replies: 3
    Last Post: 09-19-2003, 03:13 PM
  5. Selecting Agent upon New Listing
    By Anonymous in forum HELP (CLOSED)
    Replies: 2
    Last Post: 08-07-2003, 09:18 AM

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
  •