How can I open a template in a overlay

abdfahim

Well-known member
Hi,

I want to open a template on an overlay. I used following code to add a button in the sidebar (following Kier's old tutorial). But I don't understand how and where to create "my_custom_template" (the template I want to open in overlay), also what should be the structure of it. I tried creating new template from Appearance menu, which did not work. Can anybody help please?

Code:
class Abdfahim_Listener
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        if($hookName == 'forum_list_sidebar')
        {
            $contents = '<div class="section">
                            <a href="{xen:link my_custom_template}" class="overlayTrigger">Test Button</a>
                        </div>'.$contents;
        }
    }
}


my_custom_template:
Code:
<div class="sectionMain">This is a test page to be show in overlay.<br></div>
 
Oh thanks for correcting the typo. But I am still unsure how to show a template in overlay. Should I create a page instead? Because, apparently putting template name doesn't work.

(I can open a custom page in overlay, btw)

Code:
<a href="{xen:link abdfahim_test_template}" class="OverlayTrigger">Test Button</a>

upload_2017-2-11_13-56-47.webp
 
Top Bottom