[SOLVED]Search results presentation

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

[SOLVED]Search results presentation

Post by rubberjohn »

Hi, I just need some information about how best to proceed with a project I'm working on.

I have 5 pages:

1) a search page where users enter keywords to find other users that match the submitted criteria
2) a results page that presents a list of the returned matches
3) a viewing page - each match (from 2) has a link that takes the user to this page that gives more information about the matched user
4) a comments page - from the viewing page the user can access another page that contains comments / feedback about the matched user that has been submitted by other users (similar to ebay).
5) a message page - where the user can leave a message (a bit like a forum post) for the matched user.

So with the setup described above what would be the best way to implement this so that as a searching user you can enter some search criteria, view the results page, select a result and view the detailed profile, view any comments left, leave a message and then get back to the previous pages.

For example the results page so you can select a different matched user or back to the search page that still contains the original search criteria you entered and then give the user the choice of changing it completely or adding to it for another search.

Is there a way to do this to avoid multple database calls so that everytime the user goes back to the results page or the viewing page the queries are not repeated?

Would it be a better solution to incorporate the comments page into the viewing page as an optional include()?

I was looking into using pop-up windows, where the detailed profile of a matched user (selected from the results page) would appear in a pop-up, but this isn't ideal because of the comments and message pages.

I don't really want the users to use the back button to achieve this - also this will resubmit the data anyway.

I know its a long one but any suggestions would be appreciated.

Thanks

rj
Last edited by rubberjohn on Sun Mar 26, 2006 4:31 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Store the search criteria in a session variable, the results in another. Use the post to page x, redirect to page y for final results so that the post won't happen. Give a link to the results page on the viewing and such pages.
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

Ok the stuff about sessions makes sense, are there any issues with storing potentially large arrays in a session var (the results)

sorry if im being thick but can you clarify:
Use the post to page x, redirect to page y for final results so that the post won't happen
thanks feyd

rj
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Massive arrays have issues in PHP, but that limit is often beyond what most people will see (above 10000 elements, depending on memory usage, in my experience)
As for the post-redirection trick, Roja wrote:Post-Redirect-Get pattern.

Solves the issues mentioned.
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

cheers for the link - so thats why when I refresh the results page I get other information from the database that was not part of the original search query
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

ive read this and the related posts in the forum can i just check that it can be achieved using only php?

thanks

rj
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

unless you're doing something weird, yes.
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

ok cheers again feyd
Post Reply