XF 1.5 Conditional Statements for Mobile, Tab, Desktop ?

Surendra.S

Active member
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'>
 
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...
 
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>
 
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 ?
 
Is the "mobile vs desktop" functionality meanwhile available? Or can it be somehow easily linked to the screen size?

The CSS media queries seem a bit complicated, also I don't need a differentiation by device.
 
Top Bottom