Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2009, 10:41 AM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Var Plugin into template forumdisplay

I apologize for my bad English, we come to my problem

I created this plugin VB3

Hook: forum display_complete

Code:
if ($_SERVER['PATH_TRANSLATED'])
{
	$path = $_SERVER['PATH_TRANSLATED'];
}
else if ($_SERVER['SCRIPT_FILENAME'])
{
	$path = $_SERVER['SCRIPT_FILENAME'];
}
else
{
}

$path_head = substr($path, 0, (strlen($path) - 17));

$file = $path_head.'/head/'.$foruminfo[forumid].'.html';
    if(file_exists($file))
    {
      $head_forum = file_get_contents($file);
  }
  else  {
   
}
The result was called into the template via this code

Code:
 <if condition='$head_forum'>
<br />
$head_forum 
<br/>
<else />&nbsp;</if>
<!-- / Asterix special header -->


With vb4 I tried to change the code but not reported any results, the plug remained unchanged.



Code:
 <!-- Asterix Special header -->
<vb:if condition="$head_forum">

{vb:raw head_forum }

<vb:else />{vb:raw file} Pippo prova&nbsp;</vb:if>
<!-- / Asterix Special header -->


The $head_forum is no longer being charged and even the variable $ file. Why?

Thanks
Reply With Quote
  #2  
Old 11-18-2009, 01:45 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One of the big changes in vB4 is that you MUST register your variable for use in a template. It's basically like telling the system that you created a variable $head_forum that you want to use in template xxxxx. So, while rendering template xxxxx, you need to say "Oh, I've got a variable $head_forum that I want to use in here". You haven't done that. You are going to have to change your plugin to do this. See this tutorial along with several blog posts on vb.com about this subject - [HOW TO - vB4] Rendering templates and registering variables - a short guide. You will also have to register the variable file. Your template looks fine after you register the variables.
Reply With Quote
  #3  
Old 11-18-2009, 04:21 PM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for the answer I try with the guide, but not create a new template as it uses forumdisplay

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

Sorry for the double post, solved by adding the plugin

Code:
vB_Template::preRegister('FORUMDISPLAY',array('head_forum' => $head_forum));
Thanks
Reply With Quote
Reply


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 06:22 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03663 seconds
  • Memory Usage 2,182KB
  • 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
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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