Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 02-25-2004, 08:29 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Phrase system

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?
Reply With Quote
  #2  
Old 02-25-2004, 08:34 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 02-25-2004, 09:45 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by filburt1
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.
Reply With Quote
  #4  
Old 02-27-2004, 02:35 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, I meant 50,000, not 5,000.

This would explain a lot:
Code:
mysql> select phrasegroup_vbms, length(phrasegroup_vbms) from language;
+------------------+--------------------------+
| phrasegroup_vbms | length(phrasegroup_vbms) |
+------------------+--------------------------+
|                  |                        0 |
+------------------+--------------------------+
1 row in set (0.00 sec)
Reply With Quote
  #5  
Old 02-28-2004, 01:24 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 02-28-2004, 01:44 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Custom phrase groups should have IDs below 1000, so this might be the reason.
Quote:
Originally Posted by filburt1
Sorry, I meant 50,000, not 5,000.
Let's take a look at function build_language():
PHP Code:
$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?
Reply With Quote
  #7  
Old 02-28-2004, 01:56 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #8  
Old 02-28-2004, 02:01 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 03-30-2005, 08:19 PM
Albus Albus is offline
 
Join Date: May 2004
Location: USA
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by filburt1
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.
Reply With Quote
  #10  
Old 03-31-2005, 03:04 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by filburt1
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 ?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:53 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04547 seconds
  • Memory Usage 2,261KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete