• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Conditional Statements for Mobile, Tab, Desktop ?

#1
Hi All,

I am using AD templates of Xenforo for placing advertisements.

I want to place different ADs for Desktop, Tablet, and Mobile.

(I am NOT using Responsive ADs)

So, are there any simple IF / DIV statements that I can use to make this possible ?

Something like below :

<div class='showDesktop'>
<div class='showTablet hideDesktop'>
<div class='showPhone hideTablet hideDesktop'>
 
#4
Also, what are the Conditional Statements with which I can distinguish various pages - Index Page, Forum Section Page, Topic Page, Search Results Page...etc

For eg, if I want to place an AD only in INDEX page...
 

Siropu

Well-known member
#5
Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
     forum index
<xen:elseif is="{$contentTemplate} == 'forum_view'" />
    forum view
<xen:elseif is="{$contentTemplate} == 'thread_view'" />
    thread view
<xen:elseif is="{$contentTemplate} == 'search_results'" />
    search results page
</xen:if>
 
#6
Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
     forum index
<xen:elseif is="{$contentTemplate} == 'forum_view'" />
    forum view
<xen:elseif is="{$contentTemplate} == 'thread_view'" />
    thread view
<xen:elseif is="{$contentTemplate} == 'search_results'" />
    search results page
</xen:if>
Thank You ! Its very useful for me.

Is there some link/guide that listed these ?