Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-21-2008, 03:35 PM
phentalmyst phentalmyst is offline
 
Join Date: Apr 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default custom phrase with variable acting funky...

i want to make a variation of the all_ times_ are_ gmt_ x_ time_ now_ is_ y variable, one that doesnt list the "all times are" part and just displays the time. when i copy the original phrase to a new one just to test and then call to it from BELOW the forum table it works just fine. however, when i put the phrase ABOVE the table, i get this:

All times are GMT%1$s. The time now is %2$s.

what am i doing wrong? do i need some certain code in the top portion of the page?

thanks!
Reply With Quote
  #2  
Old 05-21-2008, 03:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Probably the time variables are not parsed at that time. The part of the code in the page that spits out the time is done later than when you are calling that phrase. So, you would need to add a plugin to spit out the time at an earlier point. That is my guess anyway.
Reply With Quote
  #3  
Old 05-21-2008, 04:14 PM
phentalmyst phentalmyst is offline
 
Join Date: Apr 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i thought that too, but then i tested the original phrase from the same early point and it works just fine. is the timestamp somehow locked to the phrase?
Reply With Quote
  #4  
Old 05-21-2008, 05:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by phentalmyst View Post
i thought that too, but then i tested the original phrase from the same early point and it works just fine. is the timestamp somehow locked to the phrase?
Are you calling the phrase correctly? You need to pass any variable to it, just like in the original call you are trying to copy.
Reply With Quote
  #5  
Old 05-21-2008, 05:26 PM
phentalmyst phentalmyst is offline
 
Join Date: Apr 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my custom phrase is named "time_is_now" and its text is set to:

All times are GMT{1}. The time now is <span class="time">{2}</span>.

i'm calling it in the FORUMHOME template like so:

$vbphrase[time_is_now]

which is exactly how the original phrase is called later down the page. and again, if i use the original phrase in this new location, calling it the same way, it works fine. i'm baffled.
Reply With Quote
  #6  
Old 05-22-2008, 07:10 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to call the phrase parser and use the variables to fill in the gaps.
Code:
<phrase 1="$fill_me_1" 2="$fill_me_2">$vbphrase[time_is_now]</phrase>
Reply With Quote
  #7  
Old 05-22-2008, 01:13 PM
phentalmyst phentalmyst is offline
 
Join Date: Apr 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

weird. i just tried that and now the output is:

All times are GMT. The time now is .

where are getting the $fill_me_1 and $fill_me_2 variables from? or do i need to do something with those?
Reply With Quote
  #8  
Old 05-22-2008, 02:46 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do a search in your files for "all_times_are_gmt_x_time_now_is_y" and you will see that it is parsed in the functions.php file, around line 4921. So, you need to do something similar for your own variable.

Line 4921:
PHP Code:
 $vbphrase['all_times_are_gmt_x_time_now_is_y'] = construct_phrase($vbphrase['all_times_are_gmt_x_time_now_is_y'], $tzoffset$timenow$datenow); 
Reply With Quote
  #9  
Old 05-22-2008, 06:58 PM
phentalmyst phentalmyst is offline
 
Join Date: Apr 2008
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ah HA! that worked perfectly lynne. thanks for your time and patience!
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 11:48 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.04453 seconds
  • Memory Usage 2,236KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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