Search

Hello all,

i hope someone can help me with a very annoying issue that is frustrating the hell out of me.

I have a dynamic datasource set up pulling in an xml feed from a weather site. I have set params in the datasource link, and a url param(url-q) which gets the users search term. In this case, cities/towns etc.

The problem I have is searching for something with more than 1 word in it, like New York, or Brisbane, Australia, comes back as a dud search. But if I replace the whitespace with a ‘+’ then it works.

The form is a very basic get method form with a single text input.

is there anyway to make the whitespaces in the new value into pluses?

The strange thing is, it shows in the URL as having pluses. And if I manually hardcode the city in the datasource with spaces in it, or pluses, it works.

Thanks in advance!

Pulled this for it’s obvious inaccuracy.

Think before I type…

Have you tried {$url-q:encoded}? (For reference.)

I’m guessing the URL in your data source is something like this:

http://website.com/path?searchterm={$url-q}

If Nils’ strategy (http://website.com/path?searchterm={$url-q:encoded}) doesn’t work, you could try an XSLT translate:

http://website.com/path?searchterm={translate($url-q, ' ', '+')}

hi guys thanks for your replies!

That’s brilliant Nils! It worked perfectly!! Thank you so much!

And thanks for your suggestion too Beiju, it’s very much appreciated.

Cheers!

Phill

Right, encode should be a checkbox on the Dynamic XML page

Right, encode should be a checkbox on the Dynamic XML page

But what if you only wanted some parameters to be encoded?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details