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

Conditional for specific pages only

Neil E.

Active member
#1
I'm working on ad_below_bottom_breadcrumb.

PAGE_CONTAINER calls ad_below_bottom_breadcrumb for every page.

I only want to display the ad on the conversation_view and thread_view pages.

In ad_below_bottom_breadcrumb I have:

<xen:hook name="ad_below_bottom_breadcrumb" />
<div class="bottomAd">
<div style="text-align: center;">
"....google ad script here...."
</div>
</div>

In EXTRA I can do a display: none for the class bottomAd in all pages EXCEPT conversation_view and thread_view. So the ad only shows where I want, however the ad "space" is still present in all the other pages, pushing the footer down.

I think I need a conditional in PAGE_CONTAINER that would be something like:
<xen:if is="{conversation_view}+{thread_view} />
<xen:include template="ad_below_bottom_breadcrumb" />
</xen:if>

Ideas?
 

Neil E.

Active member
#2
The CSS wasn't taking hold, so the footer was pushed down by the google "fill ad space with blank space" function. I moved the code block in EXTRA and it started working.

I'd still like to know if a conditional could be made to work.
 

EQnoble

Well-known member
#3
I'm working on ad_below_bottom_breadcrumb.

PAGE_CONTAINER calls ad_below_bottom_breadcrumb for every page.

I only want to display the ad on the conversation_view and thread_view pages.

In ad_below_bottom_breadcrumb I have:

<xen:hook name="ad_below_bottom_breadcrumb" />
<div class="bottomAd">
<div style="text-align: center;">
"....google ad script here...."
</div>
</div>

In EXTRA I can do a display: none for the class bottomAd in all pages EXCEPT conversation_view and thread_view. So the ad only shows where I want, however the ad "space" is still present in all the other pages, pushing the footer down.

I think I need a conditional in PAGE_CONTAINER that would be something like:
<xen:if is="{conversation_view}+{thread_view} />
<xen:include template="ad_below_bottom_breadcrumb" />
</xen:if>

Ideas?
add this under <xen:hook name="ad_below_bottom_breadcrumb" />
Code:
<xen:if is="in_array({$contentTemplate}, array('conversation_view', 'thread_view'))">
 
    <div class="bottomAd">
 
        <div style="text-align: center;">
 
            "....google ad script here...."
   
        </div>
 
    </div>
 
</xen:if>
 

Neil E.

Active member
#4
I tried your code exactly as posted but it didn't work right. The ad showed up on all pages. I tried another variation but received the same result.

<xen:if is="{$contentTemplate} == 'conversation_view' || 'thread_view' ">
<xen:hook name="ad_below_bottom_breadcrumb" /> .....[google script and classes inside this template]
</xen:if>
I can stay with the CSS method.
 

EQnoble

Well-known member
#5
I tried your code exactly as posted but it didn't work right. The ad showed up on all pages. I tried another variation but received the same result.

<xen:if is="{$contentTemplate} == 'conversation_view' || 'thread_view' ">
<xen:hook name="ad_below_bottom_breadcrumb" /> .....[google script and classes inside this template]
</xen:if>
I can stay with the CSS method.
I am sorry...color me stupid but I posted something completely irrelevant....



This will work... just wanted to follow up so the right info is out there

HTML:
<xen:if is="in_array({$contentTemplate}, array('conversation_view', 'thread_view'))">
 
    <div class="bottomAd">
 
        <div style="text-align: center;">
 
            "....google ad script here...."
 
        </div>
 
    </div>
 
</xen:if>
Sorry about the confusion