vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Use custom template within postbit_legacy (https://vborg.vbsupport.ru/showthread.php?t=218045)

markuswarren 07-07-2009 10:52 AM

Use custom template within postbit_legacy
 
Hello all,
I've followed the advice in this thread on how to add a custom template using plugins and it's working perfectly for a custom template I've setup to be displayed in the header template.

I wanted to do something similar for the postbit_legacy template. I have badges that appear in the user's postbit depending on certain criteria, be they picked up from a custom profile field or via membership of a usergroup.

At present my code for this is within the postbit_legacy template and thus when I need to edit the badge code I need to edit postbit_legacy. I thought it would be somewhat cleaner, and prevent me from accidentally deleting something, if I used a custom template for my badge code, and then called that template from within postbit_legacy.

I create two new plugins for the new template, change the values to match my new template name, then put the variable in postbit_legacy but it does not seem to be loading the new template.

Is there something special I need to do to get this to work for postbit_legacy, or is it something that cannot be done?

Lynne 07-07-2009 02:25 PM

It should work since I do that on my site. You didn't post your plugin code or tell us which hook locations you are using, so it's hard to tell where you may have made your error.

markuswarren 07-08-2009 12:51 PM

Hello Lynne,
Well it would be *far* too helpful if I actually posted the code wouldn't it? :D

Here are the screenshots of the two plugins I've setup:

https://vborg.vbsupport.ru/external/2009/07/41.png

https://vborg.vbsupport.ru/external/2009/07/42.png


I've created a new template in my style and named it "custom_badges" (without the quotes of course). All it currently contains is the following text: "TEXT FOR CUSTOM BADGES"

I've then edited the postbit_legacy template and entered "$custom_badges" (again without the quotes) in the position where I want the custom template code to appear. I've cleared history and cache in my browser and quit and relaunched but the custom text isn't displayed.

I'm thinking perhaps it might be the hook location for "parse template custom_badges" which is set to "parse_templates", and that it should be changed to something else; postbit_display_complete?

Lynne 07-08-2009 02:06 PM

Images are not my friend right now (I'm on vacation and stuck on dial-up). But, I think you are correct in that your hook location is incorrect. I use the postbit_display_start to eval my template (although mine is also using a template_hook, but that shouldn't matter). Just try changing the hook location and see if it works then.

markuswarren 07-08-2009 02:15 PM

Apologies for the images, I'm lazy!

I'll try changing the hook location and will report back

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

I've just tried changing the hook to "postbit_display_complete" and it is now working! Thank you for you help, it is much appreciated.


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