PDA

View Full Version : construct_phrase() not working.


harmor19
11-21-2006, 02:45 AM
Can someone tell me what I'm doing wrong?

construct_phrase($vbphrase['tooshort'], $vbulletin->options['minimumcharsforsearch']);
$vbulletin->options['minimumcharsforsearch'] is for my hack.

Adrian Schneider
11-21-2006, 03:01 AM
What's the result? Where are you using it?

Check your two input values as well (var_dump or something similar).

harmor19
11-21-2006, 04:55 AM
I echo both but $vbphrase['tooshort'] won't parse.

Adrian Schneider
11-21-2006, 04:58 AM
Inside a function? Phrase cached?

harmor19
11-21-2006, 05:16 AM
I just used echo $vbphrase['tooshort'];. I don't know how to cache a phrase.

Adrian Schneider
11-21-2006, 05:21 AM
When you enter the phrase group in the $phrasegroups array (beginning of a file), it will tell vBulletin which phrase groups should be cached. Using a phrase that isn't won't work. The exception is global phrases, which are always cached.

harmor19
11-21-2006, 05:34 AM
This is odd. It's throwing this error


SELECT
userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid,
language.phrasegroup_search AS phrasegroup_search,
language.phrasegroup_error AS phrasegroup_error,
language.phrasegroup_global AS phrasegroup_global,
language.options AS lang_options,
language.languagecode AS lang_code,
language.charset AS lang_charset,
language.locale AS lang_locale,
language.imagesoverride AS lang_imagesoverride,
language.dateoverride AS lang_dateoverride,
language.timeoverride AS lang_timeoverride,
language.registereddateoverride AS lang_registereddateoverride,
language.calformat1override AS lang_calformat1override,
language.calformat2override AS lang_calformat2override,
language.logdateoverride AS lang_logdateoverride,
language.decimalsep AS lang_decimalsep,
language.thousandsep AS lang_thousandsep

FROM user AS user
LEFT JOIN userfield AS userfield ON (user.userid = userfield.userid)
LEFT JOIN usertextfield AS usertextfield ON (usertextfield.userid = user.userid) LEFT JOIN language AS language ON (language.languageid = IF(user.languageid = 0, 1, user.languageid))

WHERE user.userid = 1;

MySQL Error : Unknown column 'language.phrasegroup_error' in 'field list'
I can see that it's selecting the column but why is it throwing the error?


I'm using
$phrasegroups = array('error');

Adrian Schneider
11-21-2006, 05:40 AM
Is that a new phrase group? If so - you have to add them using a function and not just create a new record in the database.

harmor19
11-21-2006, 05:45 AM
Search for the varname "tooshort" in your phrases and you'll see it's under "Error Messages" and the fieldname for "Error Messages" is "error".

Adrian Schneider
11-21-2006, 06:34 AM
Error phrases are handled differently in the fact that they aren't cached with the rest of the phrases. Instead, it grabs em as it needs them and caches them inside the function (static). Try this:eval(standard_error(fetch_error('tooshort', $vbulletin->options['postminchars'])));That's how vBulletin does it - and if you follow the fetch_error function, it will execute fetch_phrase which actually fetches it from the database.

harmor19
11-21-2006, 06:51 AM
Thanks a million, it works. If you have any unanswered support questions send them my way and I'll do my best to answer them.

Lionel
12-20-2007, 10:52 PM
Inside a function? Phrase cached?

Sorry to bring this old post back to life. So it's not possible to use $vbphrase inside a function?

--------------- Added 1198198561 at 1198198561 ---------------

OK. I put it in the global. all is fine now