Flag to see if search was triggered

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

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 Jason - June 24, 2013

Hi,

The easiest way to check for the existence of a number in the url is to use getLastNumberInUrl();  This is going to be easiest that checking the $_REQUEST array.

Hope this helps,

Jason

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

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