Implemented Template Hooks

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
Sure that the Beta 3 Templates are ok?

I couldn't find any <xen:hook> in the templates.
We have the code listener but how can we use it without hooks in the templates?
 
Upvote 0
This suggestion has been implemented. Votes are no longer accepted.
For the sound notification addon, it would be useful to have a hook in the navigation_visitor_tab:

Code:
<!-- conversations popup -->
 
<li class="navTab inbox Popup PopupControl PopupClosed">             
 
<a href="{xen:link conversations}" rel="Menu" class="navLink NoPopupGadget">{xen:phrase inbox}
 
<strong class="itemCount {xen:if {$visitor.conversations_unread}, '', 'Zero'}" id="ConversationsMenu_Counter" data-text="{xen:phrase you_have_x_new_unread_conversations}">
 
<span class="Total">{xen:number $visitor.conversations_unread}</span>
 
<span class="arrow">{ADD HOOK HERE}</span>
 
</strong>
 
</a>
Thanks a lot.
 
Another one in the forum_view template. I like to see

<xen:hook name="forum_view_threads_beneath" params="{xen:array 'forum={$forum}'}" />

beneath the forumlist.
 
Template node_forum_level_2

did you remove the params form the hook?

Please add them like it was before.

HTML:
<xen:hook name="node_forum_level_2_before_lastpost" params="{xen:array 'forum={$forum}'}" />
 
I'd like a hook between the footer links and footer legal so I could add mega footer between them.
Within template footer

HTML:
    </div>
</div>
 
<div class="footerLegal">
    <div class="pageWidth">

HTML:
    </div>
</div>
<xen:hook name="footer_after_links_before_legal" />
<div class="footerLegal">
    <div class="pageWidth">
 
Is there any reason, why you stopped implementing the template hook requests?

1.1.0 was the last release with new hooks:(
 
Suggestion: Add template hooks for moderation: Inline Mod Controls of threads and posts and near Thread Tools (thread_view). Then it will be easier to additional functionality.
 
I did look for it, but it appears no-one has suggested it - a nodeText level template hook.

Firstly, the reason. I'm working on an addon to add 'Sponsored By x' under the Forum title, but currently there is no template hook that allows you to alter the nodeText block.

This is fixed very simply by wrapping the nodeText div with a template hook, which then allows you to alter the HTML within the hook.

In my case that's injecting HTML after the </h3> tag of the node title.

I'm sure other people could find a use for altering the NodeText as well.
 
Having these two template hooks would make my life very much easier as far as modifying navigation goes if they are something that can be added.

Template: navigation

Code:
<xen:hook name="above_navtabs"></xen:hook>
<div class="navTabs">


Code:
</ul>
   
    <xen:if is="{$visitor.user_id}"><xen:include template="navigation_visitor_tab" /></xen:if>
  </div>
<xen:hook name="below_navtabs"></xen:hook>
 
and also if possible in the footer template

HTML:
            </xen:hook>
            </ul>
           
            <span class="helper"></span>
            <add hook here>
        </div>
 
I did look for it, but it appears no-one has suggested it - a nodeText level template hook.

Firstly, the reason. I'm working on an addon to add 'Sponsored By x' under the Forum title, but currently there is no template hook that allows you to alter the nodeText block.

This is fixed very simply by wrapping the nodeText div with a template hook, which then allows you to alter the HTML within the hook.

In my case that's injecting HTML after the </h3> tag of the node title.

I'm sure other people could find a use for altering the NodeText as well.
For that you can just modify the $forum[title] on the XenForo_ViewPublic_Forum_List class
 
A hook(with attachment as param) inside the attachmentcontainer loop would be useful, so we can add additional attachment data:)

Code:
<xen:foreach loop="$post.attachments" value="$attachment">
<li class="attachment{xen:if {$attachment.thumbnailUrl}, ' image'}" title="{$attachment.filename}">
<div class="boxModelFixer primaryContent">
 
<div class="thumbnail">
<xen:if is="{$attachment.thumbnailUrl} AND {$canViewAttachments}">
<a href="{xen:link attachments, $attachment}" target="_blank" class="LbTrigger"
data-href="{xen:link misc/lightbox}"><img 
src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" class="LbImage" /></a>
<xen:elseif is="{$attachment.thumbnailUrl}" />
<a href="{xen:link attachments, $attachment}" target="_blank"><img
src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" /></a>
<xen:else />
<a href="{xen:link attachments, $attachment}" target="_blank" class="genericAttachment"></a>
</xen:if>
</div>
 
<div class="attachmentInfo pairsJustified">
<h6 class="filename"><a href="{xen:link attachments, $attachment}" target="_blank">{$attachment.filename}</a></h6>
<dl><dt>{xen:phrase file_size}:</dt> <dd>{xen:number $attachment.file_size, size}</dd></dl>
<dl><dt>{xen:phrase views}:</dt> <dd>{xen:number $attachment.view_count}</dd></dl>
</div>
</div>
</li>
</xen:foreach>
 
pls add an hook (and some str_replace strings) inside the sidebar of template member_list so we're able to add own blocks
hook.webp

PHP:
<div class="section newestMembers">
<div class="secondaryContent avatarHeap">
<h3>{xen:phrase newest_members}</h3>
 
<ol>
<xen:foreach loop="$latestUsers" value="$user">
<li><xen:avatar user="$user" size="s" text="{$user.username} ({xen:datetime $user.register_date})" class="Tooltip" title="{$user.username}, {xen:phrase joined}: {xen:datetime $user.register_date}" /></li>
</xen:foreach>
</ol>
</div>
</div>
 
<xen:if is="{$xenOptions.facebookAppId} AND {$xenOptions.facebookFacepile}">
<xen:container var="$facebookSdk">1</xen:container>
<fb:facepile width="{xen:property sidebar.width}" size="small" colorscheme="{xen:property fbColorScheme}"></fb:facepile>
</xen:if>
</xen:sidebar>
 
Pages:
A hook at the bottom of pagenode_container wrapped around bottomContent
would be very useful. Thank you.
 
How do you get at $post?

By doing:

Code:
$params = $template->getParams();

You only get access to:

session, sessionId, requestPaths, visitor, visitorLanguage, xenOptions, xenCache, serverTime, debugMode, controllerName, controllerAction, viewName, visitorStyle, thread, forum, posts, page, postsPerPage, totalPosts, postsRemaining, canReply, canQuickReply, canEditThread, canDeleteThread, canMoveThread, canWatchThread, canViewIps, canViewAttachments, deletedPosts, moderatedPosts, inlineModOptions, firstPost, lastPost, unreadLink, poll, attachmentParams, attachmentConstraints, showPostedNotice, nodeBreadCrumbs, qrEditor, _styleId, session, sessionId, requestPaths, visitor, visitorLanguage, xenOptions, xenCache, serverTime, debugMode, controllerName, controllerAction, viewName, visitorStyle, thread, forum, posts, page, postsPerPage, totalPosts, postsRemaining, canReply, canQuickReply, canEditThread, canDeleteThread, canMoveThread, canWatchThread, canViewIps, canViewAttachments, deletedPosts, moderatedPosts, inlineModOptions, firstPost, lastPost, unreadLink, poll, attachmentParams, attachmentConstraints, showPostedNotice, nodeBreadCrumbs, qrEditor, _styleId

As the template object is actually thread_view

You can access access $message that was mapped from posts loop.
 
It would be nice to have a hook in the admin template user_search
Inside the popup <xen:popup title="{xen:phrase common_searches}">
so we can add are own custom searches.

Other hooks in that template would be great to add things such as custom user fields.
Thanks.
 
Top Bottom