Cleaning Query Strings in Urls
Hey, if I have a module that lists a bunch of items, but also has a set of fields to filter the listing, when a user chooses an option for one of the filters, the resulting Url looks like this...
/some-page/?a=&b=&c=&d=&e=something&f=
What's the best way to clean out the empty parameters in that? Is there a built-in Contao method for doing this?
Right now I'm looping through all the GET variables, removing the empty ones manually and then redirecting at the end. But I was just curious if there's an easier/more efficient way.
Re: Cleaning Query Strings in Urls
I think it is as simple as
Code:
$clean_get = array_filter($_GET);
then you can re-create the url by using the "Controller::generateFrontendUrl" method
Re: Cleaning Query Strings in Urls
Awesome, thanks. Simple indeed.