Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Previous / Next in listingview

  1. #1
    Join Date
    Apr 2005
    Posts
    14

    Exclamation Previous / Next in listingview

    Sorry if this has been covered before in another post. I've searched on a few different combinations. I'm trying to modify the LISTINGVIEW and LISTINGBROWSE files to come up with a way to move ahead or behind a listing without having to go back to the search or listings pages. Right now i'm trying to pick apart the prev_next() function but its not providing the results that I need.

    has anyone seen a mod or a project that I may be able to use some reference from? Any help on this would be greatly appreciated.

    http://solvent.gotdns.com:81/realty/index.php

    TIA for help.

  2. #2
    Join Date
    Jan 2005
    Posts
    349

    Default

    Well, here are some thoughts. When your listings are solid the code $next = $_GET[listingID] +1; will give you what you need to link to the next and -1 for previous that way. That is weak though. Checking the active status in both directions incrementing by 1 is a way to get through the whole lot 1 by one. Since this is probably not what you are looking for here is another suggestion. Use the listing_browse logic to make your pagination. copy the next prev code call it maybe next_prev2 perhaps. Alter the display template of the listing_browse2 and call it whatever you want. Alter it to show like your view page. Make a new index for config to replace $config['listings_per_page'] like $config['listings_per_page2'] and change in next_prev to match and set this to 1. Now you have pagination. Change your link code in listing_browse to call the new page with the correct guidestring and cur_page and you set right down in the correct pagination for your search. That math would look like cur_page value x $config['listings_per_page'] then count as you loop through the display in listing browse like this. The fourth listing on page 2 if $config['listings_per_page'] is 10 would be number 24 or the 24th page if $config['listings_per_page2'] is set to 1.

    I understand this is a brief description, but I thought you might want to consider this.

  3. #3
    Join Date
    Apr 2005
    Posts
    14

    Default

    Thanks for the idea. I was thinking however that the code
    Code:
     $next = $_GET[listingID] +1;
    Could be used in conjunction with a simple queried value to navigate records.

    Also Because we have access to ADO controls there is a function Ado.Recordset.movenext function. This will go ahead another record (this is in adodb.inc.php
    Code:
    	/**
    	 * Move to next record in the recordset.
    	 *
    	 * @return true if there still rows available, or false if there are no more rows (EOF).
    	 */
    	function MoveNext() 
    	{
    		if (!$this->EOF) {
    			$this->_currentRow++;
    			if ($this->_fetch()) return true;
    		}
    		$this->EOF = true;
    		/* -- tested error handling when scrolling cursor -- seems useless.
    		$conn = $this->connection;
    		if ($conn && $conn->raiseErrorFn && ($errno = $conn->ErrorNo())) {
    			$fn = $conn->raiseErrorFn;
    			$fn($conn->databaseType,'MOVENEXT',$errno,$conn->ErrorMsg().' ('.$this->sql.')',$conn->host,$conn->database);
    		}
    		*/
    		return false;
    	}
    So, with a few modifications you can rewrite this function simply to move ahead to the next record then retreive your basic listing information to your listingview.php page.

    <b>Sounds Easy enough. If i get this to work i'll post the code.</b>

    Michael
    Last edited by v3kt0r; 04-28-2005 at 11:29 AM.

  4. #4
    Join Date
    Apr 2005
    Posts
    14

    Exclamation Tinkering

    top of menu.php
    I REALISE THAT THIS CODE MAKES CERTAIN ASSUMPTIONS RIGHT NOW.. IE THAT THE LIST OF ACTIVE ESTATE IS SEQUENTIAL.. I'M WORKING THIS OUT.. STAY TUNED


    Code:
    <?php
    $trying = $_GET['listingID'];
    $first = "select id from default_listingsDB where active='yes'";
    $last = "select max(id) from default_listingsDB where active='yes'";
    
    //---------------------------------
    $recordSet = $conn->Execute($first);
    if ($recordSet === false)
    {
      log_error($sql);
    }
    $first = make_db_unsafe($recordSet->fields['id']);
    //----------------------------------
    
    //----------------------------------
    $recordSet2 = $conn->Execute($last);
    if ($recordSet2 === false)
    {
      log_error($sql);
    }
    $end = make_db_unsafe($recordSet2->fields['max(id)']);
    //----------------------------------
    
    $next = $_GET['listingID'] +1;
    
    if ($next >= $end)
    {
      $next = $end;
    }
    
    $prev = $_GET['listingID']-1;
     if ($prev <=$first)
     {
     $prev = $first;
     }
    and I have an href in html.

    Code:
      <a href = "<?echo $config['baseurl'].'/'.index.'.'.php?>">MAIN</a href>
      <a href = "<?echo $config['baseurl'].'/'.basic.'.'.php.'?'.'listingID='.$next?>">NEXT</a href>
      <a href = "<?echo $config['baseurl'].'/'.basic.'.'.php.'?'.'listingID='.$prev?>">BACK</a href>
    WHERE BASIC.PHP is your file you want for listingview or listing_browse etc..

    Basically it wont let you move to a record that doesnt exist 1 higher or 1 lower than the first or last ACTIVE records in your database table. Pretty effective.

    COMMENTS WELCOME.. I'll post updates on this one..
    Last edited by v3kt0r; 04-29-2005 at 01:00 AM. Reason: UPDATE

  5. #5
    Join Date
    Jun 2004
    Location
    Central Mexico
    Posts
    327

    Thumbs up Listing View Navigation

    Hi v3kt0r,

    I have been asking about this feature for a year and a half. I don't understand why it has been ignored by every version of OR. In fact, I can't think of another function for OR that would make such an important impact on the attractiveness or functionality of OR.

    If the listing browse page can keep track of a search that produces, say, 54 properties that meet your search criteria, and can reload the browse listing page with page after page of listing results, why the heck can't we skip the Listing Browse page altogether if we want? It feels like close to two years that I have been pestering this forum asking when OR is going to extend the functionality of the Listing View page.

    Why can't we just STAY on the Listing View details page and look at nothing but the details for all the different properties we have conducted a search for?

    And after following OR's versions and mods all these months I STILL have NOT installed it for anybody just because of the lack of this feature.

    There are other PHP listing programs, such as for photos, that easily allow this capability without REQUIRING you to keep using your Browser Back button to "mechanically" return to the browse page simply to use it as a navigation bar!

    So, v3kt0r, HOW IS your modification coming along?

    I notice at your present example, if this is it, http://solvent.gotdns.com:81/realty/index.php that the Previous and Next function arrows move through the whole database. Instead of just through the selected search criteria. For instance, if I look for just Homes and it returns 7 homes on the listing browse page out of 15 properties listed on your site, the Listing View page can access all 15 properties using your Arrows.

    So the arrows are not responding to the actual limitations of a search, they are accessing the entire database without any regard to how I want to limit the properties I want to view on the Listing View page.

    I am hoping someone comes up with a Listing View Navigation header that responds only to the Search criteria that produced the Browse Listing page.


    Thanks for tackling it!
    Last edited by thunderMex; 05-09-2005 at 01:57 PM. Reason: to add text

  6. #6
    Join Date
    May 2004
    Posts
    840

    Default

    This is a job request! I'm interested and willing to test.
    RealEstate

  7. #7
    Join Date
    Apr 2005
    Posts
    14

    Default Working

    Allright, I really appreciate the feedback on this one. I have currently come up with a working model and its available for anyone who wants to take a look at it.

    ThunderMEx. To be all honest i haven't done alot more work with the feature for the last little while as I've had to focus on other areas of the site. But now that I know there is more than just myself who realised that this feature was desperatly needed I'm going to see what i can do to certainly beef this up and make it really nice. As for your ideas of staying within the bounds of your current search I'm sure I could work that up for you. If you'd like to drop me a line so we can talk about this my email address is keepingm at gmail dot com.

    All current tests are being hosted by a friend of mine with a persistent secure connection at http://www.ironmail.ca/allstartest2 (all revisions will be updated and posted there).

  8. #8
    Join Date
    May 2004
    Posts
    840

    Default

    v3, thanks I got your private message.

    I tested your next previous mod, but the thing is that is just
    increasing or decreasing the listing ID number..

    But is not taking into consideration the search querry.
    Go here adn do a search for farsm:
    http://solvent.gotdns.com:81/realty/index.php

    there are 5 listings.

    When visiting the 1st farm listingview, i see the next button. But the button takes you the next higher ID listing. It doesnt take you to the actual next FARM listing.
    RealEstate

  9. #9
    Join Date
    Apr 2005
    Posts
    14

    Default

    Quote Originally Posted by RealEstate
    v3, thanks I got your private message.

    I tested your next previous mod, but the thing is that is just
    increasing or decreasing the listing ID number..

    But is not taking into consideration the search querry.
    Go here adn do a search for farsm:
    http://solvent.gotdns.com:81/realty/index.php

    there are 5 listings.

    When visiting the 1st farm listingview, i see the next button. But the button takes you the next higher ID listing. It doesnt take you to the actual next FARM listing.
    I do understand that. But as i said. I'm still working on tweaking the queries. I haven't been working with OR that long but that is a feature that needs to be dealt with. I'll try and work that out within the next day or two and let you know how that works. Any other suggestions or comments are welcome.

    V3k

  10. #10
    Join Date
    Mar 2004
    Location
    België
    Posts
    92

    Default

    I have a working site with this feature.
    I use a cookie to store the list of the id's, the listingview reads that list and shows a next prev.
    Try it on my page (it is in dutch however)
    http://www.jurimmo.be/

    You can find the mod here:

    http://support.open-realty.org/showthread.php?t=3953

    al long time ago i made this mod but i didn't get any reaction...

    I hope someone can do something with it.

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
  •