PDA

View Full Version : Use custom template within postbit_legacy


markuswarren
07-07-2009, 10:52 AM
Hello all,
I've followed the advice in this (https://vborg.vbsupport.ru/showthread.php?t=119933) 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 1247067674 at 1247067674 ---------------

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.