SiteTalkZone |
02-14-2011 05:09 AM |
Cannot get content of template properly from plugin
I use vB4.1
I'd like replace current block friend in MEMBERINFO template by another block with some changing about addition content.
I found the sidebar in MEMBERINFO template, like that:
Code:
<vb:comment>sidebar</vb:comment>
{vb:raw template_hook.profile_sidebar_first}
{vb:raw blocks.stats_mini}
{vb:raw template_hook.profile_sidebar_stats}
{vb:raw blocks.friends_mini}
{vb:raw template_hook.profile_sidebar_friends}
{vb:raw blocks.albums}
{vb:raw template_hook.profile_sidebar_albums}
{vb:raw blocks.groups}
{vb:raw template_hook.profile_sidebar_groups}
{vb:raw blocks.visitors}
{vb:raw template_hook.profile_sidebar_last}
<vb:comment>sidebar</vb:comment>
I write a new plugin by following code (hook location is member_build_blocks_start):
Code:
$templater = vB_Template::create('memberinfo_block_friends_mini');
$friends_mini = $templater->render();
$miblock['block_template'] = $friends_mini;
$templater = vB_Template::create('profile_sidebar_friends');
$friends_hook = $templater->render();
$miblock['template_hook'] = $friends_hook;
vB_Template::preRegister('MEMBERINFO', array('newBlockFriends' => $miblock);
And then I replace above sidebar section with new code here:
Code:
<vb:comment>sidebar</vb:comment>
{vb:raw template_hook.profile_sidebar_first}
{vb:raw blocks.stats_mini}
{vb:raw template_hook.profile_sidebar_stats}
{vb:raw newBlockFriends.block_template}
{vb:raw newBlockFriends.template_hook}
{vb:raw blocks.albums}
{vb:raw template_hook.profile_sidebar_albums}
{vb:raw blocks.groups}
{vb:raw template_hook.profile_sidebar_groups}
{vb:raw blocks.visitors}
{vb:raw template_hook.profile_sidebar_last}
<vb:comment>sidebar</vb:comment>
But when I display my profile page, it only display Friend block with content is " has not made any friends yet" although I had made some friend before. It cannot display list of my friend in Friend block in sidebar of profile page.
Help me with this situation. It's urgent please.
Thanks!
--------------- Added [DATE]1297737858[/DATE] at [TIME]1297737858[/TIME] ---------------
It's fixed!
All above things are correct.
|