Log in

View Full Version : Phrase system


filburt1
02-25-2004, 08:29 PM
Can somebody give a brief overview of how to create a custom phrase group and use it within custom templates?

I made a custom phrase group called "vbms" ("vBulletin Mail System" as the title) and an ID of 5000 and added it to the phrasetype table. I added a phrase via the admin CP frontend. I also added a phrasetype_vbms column to the language table and rebuilt all languages. Finally I used $phrasegroups = array("vbms"); before including global.php and used $vbphrase[other_vbms_links] within a custom template. The phrase text doesn't show up; neither does anything else.

Ideas?

Andreas
02-25-2004, 08:34 PM
Custom phrase groups should have IDs below 1000, so this might be the reason.

Take a look at function add_phrase_type() in adminfunctions_language.php

Dark_Wizard
02-25-2004, 09:45 PM
Can somebody give a brief overview of how to create a custom phrase group and use it within custom templates?

I made a custom phrase group called "vbms" ("vBulletin Mail System" as the title) and an ID of 5000 and added it to the phrasetype table. I added a phrase via the admin CP frontend. I also added a phrasetype_vbms column to the language table and rebuilt all languages. Finally I used $phrasegroups = array("vbms"); before including global.php and used $vbphrase[other_vbms_links] within a custom template. The phrase text doesn't show up; neither does anything else.

Ideas?

5000 is already used by vbulletin for the "vBulletin Settings", unless you want to add your options to vb's options then I suggest you may want to do as KirbyDE suggested. Just look at the table "phrasetypes" to see what is used and what vb has reserved for future use.

filburt1
02-27-2004, 02:35 PM
Sorry, I meant 50,000, not 5,000.

This would explain a lot:

mysql> select phrasegroup_vbms, length(phrasegroup_vbms) from language;
+------------------+--------------------------+
| phrasegroup_vbms | length(phrasegroup_vbms) |
+------------------+--------------------------+
| | 0 |
+------------------+--------------------------+
1 row in set (0.00 sec)

filburt1
02-28-2004, 01:24 PM
This is essentially the last thing that needs to be done for an alpha of vBMS, and I don't like seeing development go stagnant, so any help would be greatly appreciated :)

Andreas
02-28-2004, 01:44 PM
Custom phrase groups should have IDs below 1000, so this might be the reason.
Sorry, I meant 50,000, not 5,000.

Let's take a look at function build_language():

$getphrasetypes = $DB_site->query("
SELECT phrasetypeid, fieldname AS title
FROM " . TABLE_PREFIX . "phrasetype
WHERE editrows <> 0 AND
phrasetypeid < 1000
");
while ($getphrasetype = $DB_site->fetch_array($getphrasetypes))
{
$gettypes[] = $getphrasetype['phrasetypeid'];
...
$phrases = $DB_site->query("
SELECT varname, text, phrasetypeid
FROM " . TABLE_PREFIX . "phrase
WHERE languageid = $languageid AND phrasetypeid IN (" . implode(',', $gettypes) . ")
");
...
$cachetext = addslashes(serialize($phrases));
$SQL .= ", phrasegroup_$cachefield = '$cachetext'";
}

$DB_site->query("UPDATE " . TABLE_PREFIX . "language SET $SQL WHERE languageid = $languageid");

Does this explain why the fields are empty? ;)

filburt1
02-28-2004, 01:56 PM
Truly sorry about that, didn't see your post.

Okay, I removed (what I think is) every trace of vBMS phrases. I added the column to language (now using 500), added the phrasetype row, added a phrase via the admin CP, rebuilt languages, and...no change. :(

Is it still caching from somewhere (possibly in datastore) or something, is my PHP code wrong...what's going on?

filburt1
02-28-2004, 02:01 PM
I just figured it out, it was a sneaky bug with variable scope. The particular phrase that I was using was used in a template generated within a function. Predictably, making $vbphrase global fixed the problem.

Thanks for the help. :)

Albus
03-30-2005, 08:19 PM
I just figured it out, it was a sneaky bug with variable scope. The particular phrase that I was using was used in a template generated within a function. Predictably, making $vbphrase global fixed the problem.

Thanks for the help. :)
How do you add a column to the language table? What I mean is, what is the initial data? I know how to physically add the column, but I have no clue what to put in for the actual value. I am assuming one should add this column before adding anything to phrasegroup and phrase.

deathemperor
03-31-2005, 03:04 PM
I just figured it out, it was a sneaky bug with variable scope. The particular phrase that I was using was used in a template generated within a function. Predictably, making $vbphrase global fixed the problem.
say filburt1, in summary what do I have to do to make custom phrases work in custom templates ?