This topic is locked

How to indicate Advanced Search has been applied to list

1/10/2019 6:40:11 AM
PHPRunner Tips and Tricks
S
smez author

Using Advanced Search on a list does not indicate that a search has been performed when the results are displayed (unless you also show the basic search on the list - which will then display the "Show all" cross icon). To make it clear that an advanced search has been applied use the following code snippet on the list page:



if($_SERVER['QUERY_STRING']!="")

{

// get query parameters

$urlQueries = explode("&",$_SERVER['QUERY_STRING']);

$urlParams = array();

foreach($urlQueries as $urlQuery)

{

$queryParts = explode("=",$urlQuery);

$urlParams[] = $queryParts[0];

}

// check for advanced search parameter

if(in_array("q", $urlParams))

echo "Displaying search results..";

}
S
smez author 2/14/2019

Sorry - that was convoluted.
Much better to use the Search API in php code snippet:



if( SearchClause::getSearchObject($table)->isUsedSrch() )

echo "Search results..";