Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Add And Use Custom Phrase Type.
deathemperor's Avatar
deathemperor
Join Date: Jul 2003
Posts: 1,270

 

HOL
Show Printable Version Email this Page Subscription
deathemperor deathemperor is offline 05-29-2006, 10:00 PM

How to add

Simple, just use these 2 lines in your install code, it will add a new phrase type with phrasegroup_name = tm_phrase, phrasegroup_title = trademanager and productid as trademanager.

PHP Code:
    require_once(DIR '/includes/adminfunctions_language.php');
    
add_phrase_type('tm_phrase''Trade Manager''trademanager'); 
The function reads

PHP Code:
/**
* Allows plugins etc. to add a phrasetype easily
*
* @param    string    Phrasetype name
* @param    string    Phrasetype title
* @param    string    Product ID
*
* @return    mixed    If insert succeeds, returns inserted phrasetypeid
*/
function add_phrase_type($phrasegroup_name$phrasegroup_title$productid 'vbulletin'

How to use

In your script, after:

PHP Code:
// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
include this this line
PHP Code:
// get special phrase groups
$phrasegroups = array('tm_phrase'); 
tm_phrase is the phrasegroup_name that you added as above.

Now you can use the phrases from "Trade Manager" phrase group to your script.

How this helps ?
I can think of these for now:
- Prevent spamming the global phrases, make it getting bigger and bigger.
- Easier to manage. Because it's your own custom phrases
- Make your product more like a product :P.

Notice
- These phrases can only use to replace global phrase. Meaning, instead of create all of them and put to Global phrase, you put it in your own group. So if you want to use them for Permissions, Error Messages, etc. you simply can't.

Correct me if I missed something.

Have fun.

wiritten by deathemperor @ www.holvn.org
Reply With Quote
  #2  
Old 07-20-2006, 04:30 PM
lightwave lightwave is offline
 
Join Date: Sep 2004
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

really great modification. i used it myself.
Reply With Quote
  #3  
Old 11-14-2006, 10:21 AM
FractalizeR's Avatar
FractalizeR FractalizeR is offline
 
Join Date: Oct 2005
Location: Russia, Moscow
Posts: 368
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have some questions:

1. How to completely delete all phrases of my plugin on uninstallation? Is this done automatically?
2.
Quote:
So if you want to use them for Permissions, Error Messages, etc. you simply can't.
Could you please explain, what this means? What do you mean under "Permissions, Error messages"?

BTW, isn't add_phrase_type deprecated yet? As I can see, for example psiStats addon for VB does not use this function, but still uses custom phrases
Reply With Quote
  #4  
Old 11-14-2006, 06:19 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. Yes when: for example when you add a phrase, you choose a product it belongs to then when the product uninstalled the phrases belong to that product will be removed too.

2. I haven't found a way to add custom phrases for Permission, Error Messages, etc (which are some phrase types). So currently it's only possible to add global phrases. The psiStats may use queries in its product installation files (xml for example). add_phrase_type just do the same, it also runs queries but it's written by vbulletin development staves so what would you choose ?
Reply With Quote
  #5  
Old 11-19-2006, 10:23 AM
FractalizeR's Avatar
FractalizeR FractalizeR is offline
 
Join Date: Oct 2005
Location: Russia, Moscow
Posts: 368
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Now I understand.
Reply With Quote
  #6  
Old 11-25-2006, 11:51 PM
steadicamop's Avatar
steadicamop steadicamop is offline
 
Join Date: Jul 2004
Location: Lancashire, UK
Posts: 379
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by deathemperor View Post
include this this line
PHP Code:
// get special phrase groups
$phrasegroups = array('tm_phrase'); 
I'm not sure if I'm missing something really simple here - but this lot doesn't seem to work for me - where can you add the $phrasegroups to? I have tried the php file I have and inside the plugin - but just not working, none of my phrases show ... would love to be able to separate them out.

Thanks

Jason
Reply With Quote
  #7  
Old 11-26-2006, 10:45 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

actually I only tried it for new files. you can see it on vbulletin files, it's placed before everything (almost).

I think it will work on plugin if you use array_merge, I will try it myself.
Reply With Quote
  #8  
Old 10-24-2009, 06:32 PM
testbot testbot is offline
 
Join Date: Feb 2009
Posts: 373
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is there away to add a translation? i want to append some txt to an existing phrase.
Reply With Quote
Reply


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 01:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05511 seconds
  • Memory Usage 2,275KB
  • Queries Executed 21 (?)
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
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)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_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