vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   custom phrase with variable acting funky... (https://vborg.vbsupport.ru/showthread.php?t=180038)

phentalmyst 05-21-2008 03:35 PM

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!

Lynne 05-21-2008 03:48 PM

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.

phentalmyst 05-21-2008 04:14 PM

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?

Lynne 05-21-2008 05:12 PM

Quote:

Originally Posted by phentalmyst (Post 1527022)
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.

phentalmyst 05-21-2008 05:26 PM

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.

Dismounted 05-22-2008 07:10 AM

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>

phentalmyst 05-22-2008 01:13 PM

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?

Lynne 05-22-2008 02:46 PM

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); 


phentalmyst 05-22-2008 06:58 PM

ah HA! that worked perfectly lynne. thanks for your time and patience!


All times are GMT. The time now is 06:34 AM.

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.01464 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete