Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
Prev Previous Post   Next Post Next
  #1  
Old 05-18-2010, 11:12 PM
NathanLedet NathanLedet is offline
 
Join Date: Nov 2005
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin Guides?

Are there any guides or anything that go over plugin development?

I'm trying to upgrade one of my plugins that uses code from vb3.8 and the error I'm getting is

Warning: fetch_template() calls should be replaced by the vB_Template class.

Where can I read up on the vB_Template Class?

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

OK I'm slowly starting to figure this out. I'm following along with this guide, but I'm only getting a blank screen.

First, I created a plugin, named Nates Tester (product ID: natestester)

Next, I went into the Style Manager, and created a new template in my theme: myCustomTemplate and placed the following code in it:
Code:
{vb:raw myScript_variable}
Next, I went to the Product Manager and created a new Product. For "Product" - I selected the plugin that I created earlier - "Nates Tester"

Hook Location - This is the part that confuses me, because I can't leave it blank, and I have no idea which hook to choose. For experiment's sake, I chose global_start - should I choose something different?

For the Title, I used the same as my plugin name - Nates Tester

Execution Order: 5

Plugin PHP Code: as per the guide

Code:
$myScript_variable = "Hello there";

$templater = vB_Template::create('myCustomTemplate');
print_output($templater->render());
Set the product to Active.

Then, I refresh the forum and I get a solid white screen. Not quite sure what I'm doing wrong here.

I'd appreciate the help

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

Oh poot. It looks like that guide I followed left out a critical piece of information

I have to register the variable, with this chunk of code:
Code:
$templater->register('myScript_variable', $myScript_variable);
So my final code looks like this:
Code:
$templater = vB_Template::create('myCustomTemplate');
$templater->register('myScript_variable', $myScript_variable);  
print_output($templater->render());
WORKS!!

But, the rest of the forum is gone. all i see is that printed variable. Still tinkin around but making progress
Reply With Quote
 

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 08:12 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.03046 seconds
  • Memory Usage 2,252KB
  • 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
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • 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