The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I've seen multiple example on how to register a custom template in an existing template but not the other way around. If I create a custom template called 'mytemplate' can anyone provide me a working example to register a stock template so that it can render inside my custom template?
I'm trying to render the memberinfo_block_friends template inside my custom template. I've tried numerous hooks and have been beating my head against the desk for the past 3 hours. Thanks in advance. |
#2
|
|||
|
|||
![]()
There shouldn't be any difference between using a "stock" template and a custom template, although no matter what template you use, you need to register all the variables it uses before it's rendered (as well as calculate the values for them). How are you using your custom template? In a plugin (and if so, which hook), or in a custom page?
|
#3
|
|||
|
|||
![]()
I'm using the "add a tab" mod as a plugin from here. It adds an additional tab to the member profile area.
https://vborg.vbsupport.ru/showthread.php?t=265971 Using that I have a custom template called 'custom_profile_tab_dashboard'. I want to render the memberinfo_block_friends template inside this custom template. I've tried multiple variations with no luck on the hook member_complete. I'm basically trying to move the sidebar blocks on the member profile page into this custom template. I've tried modifying the above mod to include: Code:
$templater->register('blocklist', $blocklist); $templater->register('memberinfo', $memberinfo); $templater->register('prepared', $prepared); $templater->register('userinfo', $userinfo); $templater->register('member', $member); --------------- Added [DATE]1321406167[/DATE] at [TIME]1321406167[/TIME] --------------- I'm hoping to use the existing templates to render the content - just in a different place. I'm hoping I wouldn't have to build a query to get friends based on a userid - pass them into a variable - just to reuse that template..??? |
#4
|
|||
|
|||
![]()
Try doing something like this: from that article on adding a tab, at the bottom of the plugin code is this:
Code:
$templater = vB_Template::create('custom_profile_tab_test'); $templater->register('selected_tab', $selected_tab); $templater->register('test_tab_content', $test_tab_content); $template_hook['profile_tabs'] .= $templater->render(); so I assume you have something similar for your custom template. Try adding (before the render() line): Code:
$templater->register('friends', $blocks['friends']); and then in your custom template: Code:
{vb:raw friends} BTW, this is kind of a guess from looking at the code in member.php - I haven't tried this at all. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|