- Discussions
- 4 647
- Messages
- 12 059
- Solutions
- 81
- J'aime
- 7 614
- Points
- 198
Adds a new template variable
This is useful in templates if you want to adjust the display of some element based on how many posts or threads or media items there are displayed.
For example, you might want to hide an element from the sidebar on short threads (or on the last page of a thread where only one or two posts are shown), to prevent the sidebar from being much longer than the content.
Usage example :
The following code might be used in a sidebar ad placement to hide the advert on short thread pages.
An even easier way :
If we combine this addon with the Template Parent addon, which gives us a shorthand way of referencing all of the various thread and forum types in template names using a new
Télécharger V1.0.0b :
Version 1.1.0 update new templates added :
xfmg_watched_media
whats_new_posts
xfmg_whats_new_media
xfmg_whats_new_media_comments
xfrm_whats_new_resources
whats_new_profile_posts
news_feed
xfrm_watched_resources
watched_forums_list
xfmg_watched_albums
xfmg_watched_categories
xfrm_watched_categories
latest_activity
tag_view
search_results
Télécharger V1.1.0 :
Version 1.1.1 - code cleanup :
- Just some code cleanup - no functionality changes. Upgrading is optional.
Télécharger V1.1.1 :
$xf.itemsThisPage
containing how many posts/media items/resources/etc. are shown on a page.This is useful in templates if you want to adjust the display of some element based on how many posts or threads or media items there are displayed.
For example, you might want to hide an element from the sidebar on short threads (or on the last page of a thread where only one or two posts are shown), to prevent the sidebar from being much longer than the content.
Usage example :
The following code might be used in a sidebar ad placement to hide the advert on short thread pages.
HTML:
<xf:if is="in_array($xf.reply.template, [
'thread_view',
'thread_view_type_article',
'thread_view_type_poll',
'thread_view_type_question',
'thread_view_type_suggestion'
]) && $xf.itemsThisPage <= 1">
<!-- show nothing -->
<xf:else />
<!-- show the item -->
</xf:if>
An even easier way :
If we combine this addon with the Template Parent addon, which gives us a shorthand way of referencing all of the various thread and forum types in template names using a new
$xf.reply.templateParent
template variable - we can simplify the above example even further :
HTML:
<xf:if is="$xf.reply.templateParent == 'thread_view' && $xf.itemsThisPage <= 1">
<!-- show nothing -->
<xf:else />
<!-- show the item -->
</xf:if>
Télécharger V1.0.0b :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
xfmg_watched_media
whats_new_posts
xfmg_whats_new_media
xfmg_whats_new_media_comments
xfrm_whats_new_resources
whats_new_profile_posts
news_feed
xfrm_watched_resources
watched_forums_list
xfmg_watched_albums
xfmg_watched_categories
xfrm_watched_categories
latest_activity
tag_view
search_results
Télécharger V1.1.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
- Just some code cleanup - no functionality changes. Upgrading is optional.
Télécharger V1.1.1 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.