PDA

View Full Version : Variables in Standard Redirect


Kirk Y
07-09-2006, 04:32 PM
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:

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
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: $myvar = "Hello World";
$vbphrase['histtd_msg'] = construct_phrase($vbphrase['histtd_msg'],$myvar);
eval(print_standard_redirect('histtd_msg', true, true));
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
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
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.

eval(standard_error(fetch_error('phrase_name',$myv ar)));

derekivey
08-14-2006, 03:49 AM
Anyone figure this out? I tried:
eval(print_standard_redirect(construct_phrase('phr ase_name', $myvar), true, true));
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.