vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   I think this is a simple question (https://vborg.vbsupport.ru/showthread.php?t=159392)

74corvette 10-03-2007 04:56 PM

I think this is a simple question
 
Maybe some of you experienced coders can help me. I'm using the Form Hack mod on my forum and have changed the thread title to include one of the variables, $normalanswer1 so that the title reflects the answer. My question how can I add another variable ($radioanswer1) to that ? Heres the code:

$newpost['title'] =& $normalanswer1;

I have tried $normalanswer1.$radioanswer1, but that did do it. Quotes dont work either.

Signed,

PHP newbie

Opserty 10-03-2007 06:26 PM

You mean like:
PHP Code:

// $newpost['title'] = 'Something, ';
// $normalanswer = 'Another thing.';
$newpost['title'] .= $normalanswer;

// Now $newpost['title'] has the value: Something, Another thing. 

I think thats what your asking, if not can you elaborate a little more?

74corvette 10-03-2007 07:02 PM

Sorry for not give you enough info. I'll try again.

THE CODE IS
1. $foruminfo = verify_id('forum', $formforumid, 0, 1);
2. $forumperms = fetch_permissions($foruminfo[forumid]);
3. $newpost['username'] =& $vbulletin->userinfo['username'];
4. $newpost['message'] =& $formsend;
5. $newpost['title'] =& $normalanswer1; (put $radioanswer1 here)
6. $newpost['parseurl'] = '1';
7. $newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

all I want to do put 2 variables on line 5. The variable has already been defined I just want to display it along with $normalanswer1.....I've tryed just putting next to $normalanswer1 it it does not show up on the output. Make any sense ?

Opserty 10-03-2007 07:32 PM

PHP Code:

$normalanswer .= ' '$radioanswer1;
$newpost['title'] =& $normalanswer1;

// OR

$newpost['title'] = $normalanswer1 $radioanswer1

Like that? :p

74corvette 10-03-2007 07:44 PM

Thank you very much. That seems to work. I believe I tried earlier and it didn't work, the only difference being the before I had the "&" in there. Can you tell me & does ? Thanks for time btw.

Eikinskjaldi 10-04-2007 01:20 AM

Quote:

Originally Posted by 74corvette (Post 1352366)
Thank you very much. That seems to work. I believe I tried earlier and it didn't work, the only difference being the before I had the "&" in there. Can you tell me & does ? Thanks for time btw.

& means pass by reference. So

$foo = 4
$bar = $foo
$bar = 6

print($foo) -> 4
print($bar) -> 6

$foo = 4
$bar = & $foo
$bar = 6

print($foo) -> 6
print($bar) -> 6


All times are GMT. The time now is 08:58 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.01894 seconds
  • Memory Usage 1,724KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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