PDA

View Full Version : using Phrases outside of install directory -- what loads them? - init.php or global.


doob
03-20-2014, 04:40 AM
Can anyone tell me what bit of code normally is repsonsible for loading the phrase system and in what php document?

My guess is its something in global.php or init.php but I'm just not seeing it!

Max Taxable
03-20-2014, 04:43 AM
It's a template hook call, right? Such as $vbphrase

doob
03-20-2014, 04:59 AM
No. I think I'm looking for something within the actual php code. Something like include_once or include or register or similar.

vBNinja
03-20-2014, 05:04 AM
I would recommend to just include global.php because the function that initializes the phrases/language (init_language()) still requires the $vbulletin object to exist

In other words, this is possible, you'd just have to go through the hassle of reverse engineering the vB initialization process.

doob
03-20-2014, 05:27 AM
I never would have guessed init_language had anything to do with phrases...

It turns out the problem was actually to do with php syntax when converting the templates into php echo statements. PHP doesn't apparently like echoing the variables from the templates, so I needed to chop up the echo into smaller bits so that instead of echoing something like

echo onFocus="if (this.value == \'$vbphrase[username]\') this.value = \'\';" />

it reads

echo onFocus="if (this.value == \'' . $vbphrase['username'] . '\') this.value = \'\';" />

So the problem was always just syntax! Slaps forhead.