The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vbphrase cached?
|
#2
|
|||
|
|||
You can use variables in phrases: Phrase Syntax
Then use the construct_phrase() function in PHP or Using Phrases in Templates |
#3
|
|||
|
|||
How do I get vbulletin to use my custom variables then?
This is what I've done, made a vbphrase. Then I update that phrase trough my own php script. And then I use that vbphrase in a template, but it displays cached data. |
#4
|
|||
|
|||
Why would you update a phrase in a script? Are you rebuilding the datastore cahce for phrases after your script updates the phrase?
|
#5
|
|||
|
|||
I've a made a script that uses a command line executable that pull information from a VoIP service. How many online atm etc. And I'm trying it get it to be displayed just where it says Currently this many online users etc.... But it displays cached data. And the way I get my data into the vbulletin tables is that my script updates a $vbphrase[var], this is done in my script online through a regular UPDATE.
Some of the code in my script that I have running on a cronjob. Code:
$number_online = substr($totalinfo[8], 13); $link = mysql_connect('localhost', '', ''); if (!$link) {die('Could not connect: ' . mysql_error());} $sql = "UPDATE database.vb_phrase SET text='".$number_online."' WHERE varname = 'online_number'"; mysql_query($sql) or die('Problem with query' . mysql_error()); Reply to the last post: I've tried to rebuild it by including the files needed for the rebuild. I could use a smarter way for doing that then to include the files needed then running build_languages(-1) |
#6
|
|||
|
|||
Phrases are not really the best place to store values, they are only intended to be used as fixed text (with the option to insert parameters).
Best solution would be to either: - Place the variable data in settings. - Place the varaible data in a seperate table - Let your shell script create an XML-file with the values and load this when needed. |
#7
|
|||
|
|||
Using a different table would be the easiset as far as I can see. But how am I able to use my own php code for getting the data on a certain spot within a template? There are some "security" it seems within the template system.
|
#8
|
|||
|
|||
Yes if using an extra table you will need to write the code in your script to revtrieve these values.
|
#9
|
|||
|
|||
Yeah I've written a script that retrieves the values, but my problem is getting the values at a certain spot on my vbulletin frontpage.
|
#10
|
|||
|
|||
By "frontpage" are you talking about a custom/modification front page? Or the default vBulletin forum index?
If its a custom page you need to ensure the script is executed to nearby where the template is fetch and that the variables are within the scope. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|