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 Hooks (https://vborg.vbsupport.ru/showthread.php?t=244372)

LMimo 06-10-2010 10:32 PM

Variables in Hooks
 
I have a variable problem in a hook. Can anyone help with why case 2 or case 3 do not work? Thanks in advance for any replies.

Case 1 (Works fine)

$test1 = "333";

build_something($test1, 0, 0)

Case 2 (Does not work)

$another1 is 333 when displayed in a template

$test1 = $another1;

build_something($test1, 0, 0)

Case 3 (Does not work)

$another1 is 333 when displayed in a template

build_something($another1, 0, 0)

Lynne 06-10-2010 11:45 PM

Very difficult to say when you aren't telling us which hook location and which template. It could be the variable for the template is rendered after your plugin and so the variable isn't available at the time.

LMimo 06-11-2010 12:02 AM

Quote:

Originally Posted by Lynne (Post 2051783)
Very difficult to say when you aren't telling us which hook location and which template. It could be the variable for the template is rendered after your plugin and so the variable isn't available at the time.

In case 2, if I actually put $test1 in the template it will actually display 333. So the 333 does actually get to the $test1 variable. For some reason though it will not work with it the same as in case 1.

It's as if this works:

$test1 = "333";
build_something($test1, 0, 0)

But this doesnt:

$another1 = "333";
$test1 = $another1;
build_something($test1, 0, 0)

Lynne 06-11-2010 12:47 AM

Sorry, but what is above should work. If you want us to figure out why it isn't working, you'll need to be more specific and post code, hook locations, and template stuff.


All times are GMT. The time now is 11:14 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.01699 seconds
  • Memory Usage 1,714KB
  • 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_quote_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