Flag to see if search was triggered

4 posts by 2 authors in: Forums > CMS Builder
Last Post: June 24, 2013   (RSS)

By In-House-Logic - June 20, 2013

Hi there,

Let's say you have a normal query where 'allowSearch' is true.

Is there any flag we can check to see if that search was actually triggered? i.e.: the user winds up on a page with a URL of : http://somesite.com/catalogue.php?-3 where the '3' is pulling from the product table where record.categroy = 3. 

Is there a native CMSB  variable such as "searchTriggered = TRUE" that we can check?

Thanks,

J.

By Jason - June 20, 2013

Hi,

There isn't a function that will detect if a search was triggered or not.  allowSearch only comes into play when there are variables in the $_REQUEST array that match fields in the section.  One way you can try to detect this is to go through each element of the request array and look for names that match fields.  This can get complicated when you are using multiple fields in a name (ex "title,content_keyword").  If you can let me know how you would need to use this, there may be other options.

Hope this helps,

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By In-House-Logic - June 20, 2013

Thanks Jason. I suspected as much. 

If the .num at the end of the URL is part of the $_REQUEST array, is there a standard index for that value? If there is then I could easily check that. Suspect that this is not the case though.

Cheers,

J.