vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   send a single variable to a vbulletin default template (https://vborg.vbsupport.ru/showthread.php?t=236804)

White_Snake 02-24-2010 06:08 PM

send a single variable to a vbulletin default template
 
on cellarius article on vbulletin templating, he explains the way to send variables to preexisiting templates is this:

PHP Code:

$templater vB_Template::create('mytemplate');
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
$templatevalues['my_insertvar'] = $templater->render();
vB_Template::preRegister('FORUMHOME'$templatevalues); 

but what when you need to only send a single variable to a existing template without the need to create a new template such as is requested on the first line?

i want to send a variable to the template editpost but this method doesnt seem to work, anybody can help me? thanks

Lynne 02-24-2010 08:33 PM

PHP Code:

$uid $vbulletin->GPC['uid'];
vB_Template::preRegister('FORUMHOME', array('uid' => $uid)); 

Now you can use {vb:raw uid} in the FORUMHOME template

White_Snake 02-24-2010 11:50 PM

Quote:

Originally Posted by Lynne (Post 1990710)
PHP Code:

$uid $vbulletin->GPC['uid'];
vB_Template::preRegister('FORUMHOME', array('uid' => $uid)); 

Now you can use {vb:raw uid} in the FORUMHOME template

hello Lynne :)

i have tried your code and it hasnt worked, ill post what i have in here:

hook: newpost_process
PHP Code:

$droled"active";
$droled $vbulletin->GPC['droled'];
vB_Template::preRegister('editpost', array('droled' => $droled)); 

thank you again for your time

Lynne 02-25-2010 03:07 AM

Just
PHP Code:

$droled"active"
vB_Template::preRegister('editpost', array('droled' => $droled)); 


White_Snake 02-25-2010 04:52 AM

Quote:

Originally Posted by Lynne (Post 1990926)
Just
PHP Code:

$droled"active"
vB_Template::preRegister('editpost', array('droled' => $droled)); 


thanks you again for your answer

but its not working at all :( any other suggestion you might have? thanks!

--------------- Added [DATE]1267137287[/DATE] at [TIME]1267137287[/TIME] ---------------

okay i got it, i was using a wrong hook location, but now, how do i send $post[field5] value to editpost? thanks!


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