vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I combine output from a phrase with a variable... (https://vborg.vbsupport.ru/showthread.php?t=97082)

JJR512 09-28-2005 06:38 PM

How do I combine output from a phrase with a variable...
 
I need to have something like this:
Phrasetext Variabletext
Where "phrasetext" is the output from a phrase, and "variabletext" is the value of a variable.

I have this to start with:
Code:

$title = $vbphrase['phrasename']
But I don't know how to get the variable text after the phrase text. Is it possible to do this all in one code line, or do I need to have multiple lines, each one adding to the result of the one before it? I'd prefer to have just one line do it all, for elegance, but I'll do it the brute-force way if necessary. Either way, I'd greatly appreciate it if you could give me a specific code example to use.

This will be used in a hack I'm about to release, and I will be sure to credit assistance to whomever's example I use. :)

Here's another question for the same project:

Can a variable be part of a phrase name? For example, through the URL you pass $var to the script. Can $var be part of the phrase name, as in:
Code:

$title = $vbphrase['phrasename_$var'];
I've already found out it doesn't work if I try it exactly like that (the output was blank, but if I hardcoded the variable in the phrase name, like phrasename_value, it did produce an output, so I know the problem is the $var in the phrase name). But is there another way to do it?

jugo 09-28-2005 06:48 PM

Code:

$title = "\$vbphrase['phrasename".$var."']";
Holy crap...check to see if that works...if it does beat me with a stick... If it doesn't don't blame me I just winged it...lol

JJR512 09-28-2005 06:56 PM

Sorry, didn't work.

The output was:
$vbphrase['phrasename']
So, part of the code was output literally, and the variable was not in the output at all.

Marco van Herwaarden 09-28-2005 08:44 PM

use construct_phrase($vbphrase['phrase'], $var)


All times are GMT. The time now is 07:32 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.00968 seconds
  • Memory Usage 1,715KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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