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

Reply
 
Thread Tools Display Modes
  #11  
Old 12-31-2009, 11:31 PM
Tamtams Tamtams is offline
 
Join Date: Nov 2009
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am using the default VBulletin 4, without any template changes.
I tried putting the word "hello" in the template, with no results - that's what caused me to start this thread in the first place...

Have you been able to successfully create and use a template in threadbit, or just via preprocess?
Reply With Quote
  #12  
Old 01-01-2010, 12:06 AM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd suggest trying a different hook like the parse_templates hook and see if that makes any difference. I had problems when I was trying to pre-register a custom template in the global hook. Changed it to the parse_templates hook after reading a comment and it fixed my problem. Can't hurt trying it anyway lol.
Reply With Quote
  #13  
Old 01-01-2010, 04:31 PM
Tamtams Tamtams is offline
 
Join Date: Nov 2009
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I thought the problem with using hook parse_templates is the template will be loaded for every page load, even though it is only required for threadbit?

Either way, the problem has been narrowed down to registering the variables within the template - obviously creating the template is working, as it is appearing in the debug information, but registering it is not. Will try to move the register to another hook, and report back on what happens

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

Ok, I can't move the template to parse_templates, as it needs access to a function which isn't loaded by that hook.
Reply With Quote
  #14  
Old 01-01-2010, 05:13 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can we see the exact code you are currently using for the plugin (which location?) and the templates.
Reply With Quote
  #15  
Old 01-01-2010, 05:14 PM
Tamtams Tamtams is offline
 
Join Date: Nov 2009
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I would guess something is wrong with your template then. Try just putting "hello" in the template and see if you get that to print out.
I tried this, no go. Very strange that the template can't render, even though VBulletin is recognizing that it was created!
Reply With Quote
  #16  
Old 01-01-2010, 09:12 PM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Tamtams View Post
Ok, I can't move the template to parse_templates, as it needs access to a function which isn't loaded by that hook.
Hmm. I just did a quick test and it worked fine for me. I created a blank template called custom_template and I put "Testing123" into it. I then created a plugin with the code that Lynne originally suggested and finally added {vb:raw custom_template} to the threadbit Template. That worked fine for me and I ended up with loads of Testing123's appearing above the list of threads (because of the floated divs I presume).
Reply With Quote
  #17  
Old 01-02-2010, 07:56 PM
Tamtams Tamtams is offline
 
Join Date: Nov 2009
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's the exact code i'm using - hook location is threadbit_display

PHP Code:
        $test_value "It Works!";
    
$templater vB_Template::create('threadworks'); 
    
$templater->register('custom_template'$test_value); 
        
$custom_template $templater->render();
        
vB_Template::preRegister('threadbit', array('threadworks' => $custom_template)); 
(I'm trying to port the Threadworks mod to VB4 )
Reply With Quote
  #18  
Old 01-02-2010, 08:31 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does your template threadworks look like?
Reply With Quote
  #19  
Old 01-02-2010, 09:10 PM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is still working for me Tamtams. I copied that code directly into a new plugin that I created especially to test this. I then created a custom template called threadworks and then added {vb:raw threadworks} to the threadbit template.

Are you definitely adding the above variable (vb:raw thing) into the correct template i.e. threadbit. If you're trying to use it in one of the other templates then that'll be why. You need to pre-register it exactly for the template you're trying to use it in.

Granted my threadworks template that I created just has Testing123 in there but its working as I'd expect. Remember this will be showing in the thread listing (inside a forum) and not inside the thread itself (I doubt you're making that mistake but just mentioning the obvious lol).

As far as I can see either you're doing something different to the above or something is seriously going crazy on your forums lol. Especially if you're trying just a test message in your template. If the test message works then that'll obviously point to the template itself causing the issue but if not then I don't know what else to suggest.

EDIT: You haven't been trying to use {vb:raw custom_template} with the above plugin code have you?

If so then that'd be wrong lol. The pugin code above registers the $custom_template variable for use inside the threadworks template and the threadworks variable for use inside the threadbit template. So {vb:raw custom_template} with your plugin code will only show it's contents at the moment inside the threadworks template of yours.
Reply With Quote
  #20  
Old 01-03-2010, 01:01 PM
Tamtams Tamtams is offline
 
Join Date: Nov 2009
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by consolegaming View Post
That is still working for me Tamtams. I copied that code directly into a new plugin that I created especially to test this. I then created a custom template called threadworks and then added {vb:raw threadworks} to the threadbit template.

Are you definitely adding the above variable (vb:raw thing) into the correct template i.e. threadbit. If you're trying to use it in one of the other templates then that'll be why. You need to pre-register it exactly for the template you're trying to use it in.

Granted my threadworks template that I created just has Testing123 in there but its working as I'd expect. Remember this will be showing in the thread listing (inside a forum) and not inside the thread itself (I doubt you're making that mistake but just mentioning the obvious lol).

As far as I can see either you're doing something different to the above or something is seriously going crazy on your forums lol. Especially if you're trying just a test message in your template. If the test message works then that'll obviously point to the template itself causing the issue but if not then I don't know what else to suggest.

EDIT: You haven't been trying to use {vb:raw custom_template} with the above plugin code have you?

If so then that'd be wrong lol. The pugin code above registers the $custom_template variable for use inside the threadworks template and the threadworks variable for use inside the threadbit template. So {vb:raw custom_template} with your plugin code will only show it's contents at the moment inside the threadworks template of yours.
Hah nope, I wasn't using {vb:raw custom_template }, I am using {vb:raw threadworks) . This issue has ben racking my head though! Consolegaming - could you just copy and paste the exact code your using so I can ensure I have replicated it properly on my local install! That would likely help me quickly identify why it is not working...
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:07 AM.


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.06619 seconds
  • Memory Usage 2,266KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete