Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 10-19-2012, 02:19 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Registering $variables for Forumhome

Hello

i need help with registering some $variables for use in Forumhome
within a plugin, the variables are already registered within a admincp file

but i want to show the same data from those $variables in a plugin
for the following Hook Location: forumhome_complete

i need to output data from $whattoecho variable

so the question is how do i register this variable to work in the plugin
Reply With Quote
  #2  
Old 10-19-2012, 03:04 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure what you're asking. You only need to register variables for use in a template, not a plugin. So when you say "the variables are already registered within a admincp file", what does that mean exactly? Maybe you're Using "registered" in some way other than what I think it means?
Reply With Quote
  #3  
Old 10-19-2012, 03:17 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I'm not sure what you're asking. You only need to register variables for use in a template, not a plugin. So when you say "the variables are already registered within a admincp file", what does that mean exactly? Maybe you're Using "registered" in some way other than what I think it means?
say for example in my admincp file whatever.php
i have the following variables registered :

PHP Code:
$whattoecho "";
if (
$httpbl != 0) {
    
$whattoecho .= "httpBL: " $httpbl " | ";

i have a template hook i want this information to appear in

PHP Code:
$template_hook[forumhome_wgo_pos2] .= ''
i have already done the following to start it off



now i need the data to appear below that so i need the data from $whattoecho
to appear below that
Reply With Quote
  #4  
Old 10-19-2012, 04:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't see any code that is registering the variables. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide It will show you the code to register your variables for use in the FORUMHOME template.
Reply With Quote
  #5  
Old 10-19-2012, 04:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by simonhind View Post
now i need the data to appear below that so i need the data from $whattoecho to appear below that
You need to calculate $whattoecho in a plugin that's called when the forumhome page is being displayed. It doesn't do any good to have it in an admincp script - you can't register it to a template from there. If you can build $whattoecho in the forumhome_complete plugin, then that's what you want to do. If there's no way to do it from there, then you'd have to figure out a way to save it in the database and read it back in when you need it.

If you do have the value in the forumhome_complete plugin, if you're using a template hook thenyou don't need to register the variable.
Reply With Quote
  #6  
Old 10-19-2012, 05:40 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I don't see any code that is registering the variables. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide It will show you the code to register your variables for use in the FORUMHOME template.
Quote:
Originally Posted by kh99 View Post
You need to calculate $whattoecho in a plugin that's called when the forumhome page is being displayed. It doesn't do any good to have it in an admincp script - you can't register it to a template from there. If you can build $whattoecho in the forumhome_complete plugin, then that's what you want to do. If there's no way to do it from there, then you'd have to figure out a way to save it in the database and read it back in when you need it.

If you do have the value in the forumhome_complete plugin, if you're using a template hook thenyou don't need to register the variable.
thank you both, i managed in the end to do it with both your help
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:54 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.10504 seconds
  • Memory Usage 2,215KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete