Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2008, 12:52 PM
weq weq is offline
 
Join Date: Feb 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vbphrase cached?

http://www.vbulletin.com/forum/showthread.php?p=1609329

Any help here instead perhaps?
Reply With Quote
  #2  
Old 08-15-2008, 02:30 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can use variables in phrases: Phrase Syntax

Then use the construct_phrase() function in PHP or Using Phrases in Templates
Reply With Quote
  #3  
Old 08-16-2008, 11:02 AM
weq weq is offline
 
Join Date: Feb 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 08-16-2008, 11:18 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why would you update a phrase in a script? Are you rebuilding the datastore cahce for phrases after your script updates the phrase?
Reply With Quote
  #5  
Old 08-19-2008, 07:37 PM
weq weq is offline
 
Join Date: Feb 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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());
so when it's displayed on my page it ain't displaying the last data I updated in my vbphrase.


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)
Reply With Quote
  #6  
Old 08-20-2008, 07:19 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 08-20-2008, 10:14 AM
weq weq is offline
 
Join Date: Feb 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 08-20-2008, 10:23 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes if using an extra table you will need to write the code in your script to revtrieve these values.
Reply With Quote
  #9  
Old 08-20-2008, 10:40 AM
weq weq is offline
 
Join Date: Feb 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 08-20-2008, 11:54 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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 12:52 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.04243 seconds
  • Memory Usage 2,243KB
  • 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)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete