Jump to content

Pre-Defined Search Link (via URL?)


This topic is 4982 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm trying to create some simple links on a Site Assistant created home screen to a few often-used search queries. I can't figure out how to construct such a link in the PHP code, though. The search parameters seem to be stored in the session, and if it is possible to construct such a search via a URL (for example: http://www.site.com/recordlist.php&-name="Fred"&-job="Boss") I can't seem to tease out the logic of it. Any ideas? Thanks much.

Link to comment
Share on other sites

I've made some significant headway on this. In the end, I had to construct some forms composed of hidden fields with submit buttons styled to be images (also could be text if need be).

The Site Assistant saves the search parameters in the session after the POST action. From there it parses they keys and values based on numerically named fields. 0 and even numbers are translated to operands and odd numbers are the search values. For example:




     

     

     

     

     

     

     

     



For this to work the $layoutName variable has to be copied from the top of the findrecords.php file.

The Site Assistant code interprets the keys that begin with a dash as general search params, and ones without as the keys and values to build the search with.

This strategy works fairly well, but I am not sure yet how compound finds with work.

Link to comment
Share on other sites

I've discovered a more serious problem than how to construct a compound find command with this strategy.

As it is right now, these forms will return the whole set of records. If you do a find through the Site Assistant generated form in the findrecords.php page AND THEN go back and click the form constructed above, then it will work. Somehow the findrecords.php page is setting something up in the session that isn't being constructed by my cobbled-together method.

Link to comment
Share on other sites

  • 4 weeks later...

Caveat: Site Assistant generated pages can quickly become a nightmare once you start modifying them. If you need custom pages you're much better off building them from scratch

To answer your question: When php loads the page it will set the key value pairs from the URL to the $_GET associative array




/* for http://www.site.com/recordlist.php&name=Fred&job=Boss */



print $_GET['name']; /* prints Fred */

print $_GET['job']; /* prints Boss */



Link to comment
Share on other sites

This topic is 4982 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.