How to find any specific template in admin control panel?

TheBigK

Well-known member
I'm currently studying the official 'Resources' add-on. Since the template_hooks are deprecated; I'm finding out how to insert more tabs on the member profile page without using template_hooks.

I'm however stuck at finding the relevant template in the admin control panel that controls the contents of the 'Resources' Tab. Is there a way to quickly find out which template any page is using? I tried looking at the page source code; but couldn't find anything relevant there.

Can someone help?

Thanks for your time!
 
Thanks a lot Brogan. I guess I began thinking it was more complicated and hence skipped the obvious parts.

Even after inspecting the 'member_view' class (in this case), I'm unable to figure out how the 'Resources' tab gets introduced without using hook. The most obvious way seems to be using the hook

Code:
<ul class="tabs mainTabs Tabs" data-panes="#ProfilePanes > li" data-history="on">
                <li><a href="{$requestPaths.requestUri}#profilePosts">{xen:phrase profile_posts}</a></li>
                <xen:if is="{$showRecentActivity}"><li><a href="{$requestPaths.requestUri}#recentActivity">{xen:phrase recent_activity}</a></li></xen:if>
                <li><a href="{$requestPaths.requestUri}#postings">{xen:phrase postings}</a></li>
                <li><a href="{$requestPaths.requestUri}#info">{xen:phrase information}</a></li>
                <xen:if is="{$warningCount}"><li><a href="{$requestPaths.requestUri}#warnings">{xen:phrase warnings} ({xen:number $warningCount})</a></li></xen:if>
                <xen:hook name="member_view_tabs_heading" params="{xen:array 'user={$user}'}" />
            </ul>
However, the event-listener list for Resources does not not use the template_hook code-event listener.

How do I find out which event is being listened to and how is the new tab titled 'Resources' being added? My best guess is that the template that's handling the contents of the 'resources' in member_view is: resource_author_view.

The ultimate question I'm tryin to get answer to: What's the recommended way to perform an action such as inserting a new tab on member profile; if template hooks aren't?
 
To add a tab to the member page, you will need (from memory):
  • A template for the tab
  • A template modification to add your tab template to the member_view template
  • A template for the tab contents
  • A template modification to add the tab contents template to the member_view template
  • Your controller function which extends ControllerPublic\Member.php
  • Your model
I think that's it.
 
They are indeed deprecated.
Alrighty. So I noticed that the Resources Manager relies on template hooks!

It searches for: <xen:hook name="member_view_tabs_heading"

and then replaces it with -

<xen:if is="{$user.resource_count} AND {$canViewResources}">
<li><a href="{$requestPaths.requestUri}#resources">{xen:phrase resources}</a></li>
</xen:if>
$0

:coffee:
 
You can find and replace on any portion of text.

Template hooks have been deprecated but that doesn't mean they have been or will be removed.

I prefer to try not to use them wherever possible, but it's all moot anyway when it comes to XF2.
 
For reference, it uses a template hook insofar as what's in the template, but that's different from using a template hook -- that's a totally different system and using that system has really been deprecated.
 
For reference, it uses a template hook insofar as what's in the template, but that's different from using a template hook -- that's a totally different system and using that system has really been deprecated.
Thanks!

I think I could just find the last tab, and then replace it with 'last tab' + 'my new tab' to achieve what I want. But is there a chance that it'd create problem of ordering the tabs if multiple addons are using this approach to add more tabs to the member profile?

Is there any other approach than what's suggested above?
 
Top Bottom