vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Template Hook on Postbit Legacy (https://vborg.vbsupport.ru/showthread.php?t=318713)

Black Snow 05-19-2015 12:51 PM

Template Hook on Postbit Legacy
 
I'm using a plugin to add some info to each post in a thread:

Template hook: parse_templates
Code:

$templater = vB_Template::create('new_info');
$template_hook['postbit_messagearea_start'] .= $templater->render();

I have used similar code before to insert a script into my header template which works a charm like this:
Code:

$templater = vB_Template::create('new_javascript');
$template_hook['headinclude_javascript'] .= $templater->render();

All I have in the template is:
Quote:

hello
But the word "hello" is not being shown on my postbit. Can any see anything I've done wrong?

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

Found out the issue. I used parse_templates instead of postbit_display_complete hook.

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

I've got another issue now. When using postbit_display_complete hook, I am trying to display a link to the post ID using this:
Code:

<a name="post{vb:raw post.postid}" href="{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_post}}#post{vb:raw post.postid}" class="<vb:if condition="$show['inlinemod']">ie</vb:if>postcounter">#{vb:raw post.postcount}</a><a id="postcount{vb:raw post.postid}" name="{vb:raw post.postcount}"></a>
I know this code is already on each post but I have another use for it.

When I run the plugin, all I get is a hash tag and a semi-finished link. This is the output:
Code:

http://MY_FORUM/test/showthread.php?1-test#post
And all it shows is a "#" without the post ID. It should link like:
Code:

http://MY_FORUM/test/showthread.php?1-test#post2
Is this because the plugin hook is rendered before the template? If so, what other hook could I use which would allow me to get the correct output?


All times are GMT. The time now is 07:02 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.00935 seconds
  • Memory Usage 1,713KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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