close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Displaying Search Terms

Thread began 1/26/2011 5:17 pm by Brad Lawryk | Last modified 1/31/2011 7:24 am by Jason Byrnes | 1870 views | 6 replies |

Brad Lawryk

Displaying Search Terms

I have a client site that I have used the Data Assist generated forms and search. It all works good. But they have a request to display the search terms that were entered into the search form above the results.

I am having difficulty finding where these are stored or how they can be retrieved and displayed. Can this be done?

Brad

Sign in to reply to this post

Dave BuchholzBeta Tester

Brad,

this is a sample of code I used in a previous project that should get you going, please note that the sample uses the GET rather than POST method

php:
<?php

foreach( $_GET as $pkey => $pval ) {
        if (
$pval != "" && strpos($pkey,"WADbSearch") !== && $pkey != "x" && $pkey != "y" && $pval != "Search Now" && $pval != "search-results")  { 
            switch(
$pkey) {
        case 
'S_title':
        echo 
'<li><span>' $i8_singular ':</span>';
        break;
        case 
'S_fk'// If foreign key field required
        
echo '<li><span>##Name##:</span>';
        break;
        case 
'S_details':
        echo 
'<li><span>Description:</span>';
        break;
        case 
'S_sortorder':
        echo 
'<li><span>Sort Order:</span>';
        break;
        case 
'S_publish':
        echo 
'<li><span>Published:</span>';
        break;
        case 
'S_dateinsert':
        echo 
'<li><span>Date Entered:</span>';
        break;
        case 
'S_dateupdate':
        echo 
'<li><span>Last Updated:</span>';
        break;
        default:
        echo 
'<li><span>Quick Search:</span>';
        }
                                                        
        switch(
$pkey) {
        case 
'S_title':
        echo 
stripslashes($pval) . '</li>';
        break;
        case 
'S_fk':
        echo 
$row_rsSearchFK['title'] . '</li>';
        break;
        case 
'S_details':
        echo 
stripslashes((str_replace("\n","&nbsp;",$pval))) . '</li>';
        break;
        case 
'S_sortorder':
        echo 
$pval '</li>';
        break;
        case 
'S_publish':
        echo ((
$pval == 1)?'Yes':'No') . '</li>';
        break;
        case 
'S_dateinsert':
        echo 
date('F jS, Y',strtotime(i8_formatUSDateMySQL($pval))) . '</li>';
        break;
        case 
'S_dateupdate':
        echo 
date('F jS, Y',strtotime(i8_formatUSDateMySQL($pval))) . '</li>';
        break;
        default:
        echo 
stripslashes($pval) . '</li>';
        }
            }
}
?>
Sign in to reply to this post

Brad Lawryk

You have to do a bunch of hand coding to simply display what values were used in the search?

All I wanna do is have it display what words the user searched for so if it doesn't bring up any results they can see if they typed it in wrong or something. Heck even having the search fields themselves still display what was searched would be enough.

Brad

Sign in to reply to this post

Jason ByrnesWebAssist

The code that Dave is giving you goes above just displaying the search term, it will also display a unique label beside aeach search term depending on which form element it is coming from.


In his example code, he has different form elements, one is named "S_publish" another is named "S_details".


his code is displaying a unique label, so if the user searched for details and published, the display would look like:
Description: <detail search term>
Published: <published search term.

if all you want to do is show the search term, go to the bindings panel and click on the plus button.

Select Form Data, click the folder icon and select your search form.

this will add dynamic data bindings for the search form on the results page.

In the bindings panel expand the search form, then drag the form element binding to the results page where you want it displayed, repeat for any other form elements you wish to display.

Sign in to reply to this post

Dave BuchholzBeta Tester

Jason is correct, I like to present a nicely formatted list that tells the searcher exactly what terms they used and what they relate to.

More work yes, but less questions from confused clients in the long run.

Sign in to reply to this post

Brad Lawryk

Thanks guys ....

I knew there had to be an easy way. Works great now. Appreciated

Brad

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...