TheBigK
Well-known member
I'm creating a small add-on that lets the admin write notes for any user on their profile in a special tab. So far-
1. I've created UserNotes/Listener/NotesTab.php
My questions:-
1. Should I transfer the entire content, which $contents will have to the template that I wish to include?
2. Or is my current method of calling the template is correct? If yes, how do I call my template from inside the single quotes?
PS: I am aware that I need to preLoad template in order for them to work. I'm yet to do that in my code.
1. I've created UserNotes/Listener/NotesTab.php
PHP:
class UserNotes_Listener_NotesTab
{
public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
// Following if check creates the heading of the tab
if ($hookName == 'member_view_tabs_heading')
{
$contents .= '<li><a href="{$requestPaths.requestUri}#notes"> Notes </a></li>';
}
// Following if check creates the contents of the tab
if ($hookName == 'member_view_tabs_content')
{
$contents .= '
<ul id="ProfilePanes">
<li id="info" class="profileContent">
<div class="section">
<h3 class="textHeading"> The Boss Left Following Notes For You </h3>
<div class="primaryContent">
||| THIS IS WHERE I NEED TO INCLUDE MY TEMPLATE |||
</div>
</div>
</li>
</ul>
';
}
}
}
My questions:-
1. Should I transfer the entire content, which $contents will have to the template that I wish to include?
2. Or is my current method of calling the template is correct? If yes, how do I call my template from inside the single quotes?
PS: I am aware that I need to preLoad template in order for them to work. I'm yet to do that in my code.