vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Variables in Standard Redirect (https://vborg.vbsupport.ru/showthread.php?t=120757)

Kirk Y 07-09-2006 04:32 PM

Variables in Standard Redirect
 
Is it possible to include variables in a standard redirect phrase? If so -- how?

CyberRanger 07-11-2006 12:12 PM

I'm searching for this too! I know I could use something like this:

PHP Code:

eval(print_standard_redirect($vbphrase['phrase1'].' '.$myvar1.'  '.$vbphrase['phrase2'],0,1)); 

but I'd rather use one phrase with the variable inserted into the appropriate spot.

Code Monkey 07-11-2006 12:59 PM

That's what the function "construct_phrase() is for.

CyberRanger 07-11-2006 01:51 PM

Quote:

Originally Posted by JumpD
That's what the function "construct_phrase() is for.

Okay, I tried this but can't make it go!
  • I created a phrase named "histtd_msg". The phrase reads "My variable is {1}. Yes it is!"
  • In my php file, I have:
    PHP Code:

        $myvar "Hello World";
    $vbphrase['histtd_msg'] = construct_phrase($vbphrase['histtd_msg'],$myvar);
    eval(
    print_standard_redirect('histtd_msg'truetrue)); 

  • When the redirect is called, the phrase in the redirect window reads: "My variable is %1. Yes it is!"

:cross-eyed:

MarkPW 07-11-2006 06:01 PM

I think you should be using {myvar} as opposed to {1}?

CyberRanger 07-11-2006 06:44 PM

Quote:

Originally Posted by MarkPW
I think you should be using {myvar} as opposed to {1}?

nope, that just leaves it as {myvar} when the phrase is displayed in the redirect.

Kirk Y 07-11-2006 08:46 PM

Quote:

Originally Posted by JumpD
That's what the function "construct_phrase() is for.

I tried construct_phrase, but it didn't work -- that's why I made this thread.

Edit: I got this to work with standard_errors, but never tried it with standard redirs., someone can give it a try if they'd like.

Code:

eval(standard_error(fetch_error('phrase_name',$myvar)));

derekivey 08-14-2006 03:49 AM

Anyone figure this out? I tried:
PHP Code:

eval(print_standard_redirect(construct_phrase('phrase_name'$myvar), truetrue)); 

and that didn't work. It printed The Phrase's Text {1}

AN-net 08-16-2006 02:40 PM

its not designed to work like that, ive complained about it before to Jelsoft but i guess nothing was done. basically all the standard_error and standard_redirect can do is pull the phrase as is. no construction what so ever. at least that was from 3.0.x, havent looked at the 3.5.x+ code.

derekivey 08-16-2006 05:32 PM

Yeah, I got it working with standard_error, but not with standard_redirect.


All times are GMT. The time now is 09:59 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.01015 seconds
  • Memory Usage 1,735KB
  • 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
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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