Jump to content

$pages->find() and multilanguage


Nico Knoll
 Share

Recommended Posts

Hi,

I'm running the newest version of processwire with multilanguage activated.

On my search page I'm using this to find pages:


if($q = $sanitizer->selectorValue($input->get->q)) {

$input->whitelist('q', $q);

$matches = $pages->get("title|body|summary|sidebar%=$q");

}

//and so on

But if I'm using it I'm always getting this error:

Exception: Unknown column 'field_title.data0' in 'where clause' (in /var/www/ud14_276/html/sgym.de/www/wire/core/Database.php line 118)

#0 /var/www/ud14_276/html/sgym.de/www/wire/core/DatabaseQuery.php(84): Database->query(Object(DatabaseQuerySelect))
#1 /var/www/ud14_276/html/sgym.de/www/wire/core/PageFinder.php(145): DatabaseQuery->execute()
#2 /var/www/ud14_276/html/sgym.de/www/wire/core/Pages.php(144): PageFinder->find(Object(Selectors), Array)
#3 [internal function]: Pages->___find('title=123', Array)
#4 /var/www/ud14_276/html/sgym.de/www/wire/core/Wire.php(271): call_user_func_array(Array, Array)
#5 /var/www/ud14_276/html/sgym.de/www/wire/core/Wire.php(229): Wire->runHooks('find', Array)
#6 /var/www/ud14_276/html/sgym.de/www/wire/core/Pages.php(213): Wire->__call('find', Array)
#7 /var/www/ud14_276/html/sgym.de/www/wire/core/Pages.php(213): Pages->find('title=123', Array)
#8 /var/www/ud14_276/html/sgym.de/www/wire/core/Pages.php(228): Pages->findOne('title=123')
#9 /var/www/ud14_276/html/sgym.de/www/si

I had a look in the database and I guess it originally tries to look for $q in both the english and german veriant. And so it should look for $q in the columns data and data1234. But instead it looks into data and data0. I don't know why...

Link to comment
Share on other sites

Try outputting this, right before your find() and let me know what it says:

echo "<p>Language: $user->language</p>";

What languages do you have installed? (how many?)

If you try switching the language, do you get a different error or no error?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...