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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-16-2011, 12:00 AM
Alteczen Alteczen is offline
 
Join Date: Jun 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Register existing template

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.
Reply With Quote
  #2  
Old 11-16-2011, 12:06 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #3  
Old 11-16-2011, 12:13 AM
Alteczen Alteczen is offline
 
Join Date: Jun 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);
I couldn't get that to do anything though... Any advise on direction would be phenominal.

--------------- 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..???
Reply With Quote
  #4  
Old 11-16-2011, 12:33 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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 11:08 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.06999 seconds
  • Memory Usage 2,190KB
  • Queries Executed 13 (?)
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
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete