XF 1.2 Conditional help

bladinium

Active member
Hello,

I need help for Ads on second post :

<xen:if is="{$post.position} == 0 AND {$conversation.first_message_id} == {$message.message_id}">

I would like the advertising does not appear in the forum: 23 and all sub forums: 23

Thanks :)
 
Hello, thanks!

The problem is that it does not work for sub forum.

Exemple :

Forum 1 (Ads ok)
Forum 2 (Ads ok)
Forum 23 (No ads)
Sub 24 (no ads)
Sub 25 (no ads)
etc... (no ads)
Forum 128 (ads ok)

Thanks for u help
 
It should display in all nodes automatically.
The code I gave was for it not to show in one particular node.

@bladinium, check you are entering the code correctly.
Node heirarchy is irrelevant when using the node ID, so it definitely works (tested and confirmed).
 
@Brogan

Hello,

I have the code in template "message"

PHP:
<xen:if is="{$post.position} == 0 AND {$conversation.first_message_id} == {$message.message_id}">
    <li class="message">

        <div class="messageUserInfo">
            <div class="messageUserBlock">
                <div class="avatarHolder"><span class="avatar  av2m"><img  src="/1.jpg?1379939746"  width="96px" height="96px"></span></div>

                <h3 class="userText">
                    Monsieur
                    <em class="userTitle" itemprop="title">Pub</em>
                </h3>

                <span class="arrow"><span></span></span>
            </div>
        </div>

      <div class="messageInfo primaryContent">
            <div class="messageContent">
            <blockquote class="messageText ugc baseHtml">
<div align="center">         
<!-- DEBUT DU SCRIPT SLIDER --> 
<xen:if is="{$forum.node_id} != 23">       
    <a href="http://www.URL/" onclick="javascript:_paq.push(['trackPageView', '2emepost']);" target="blank"><img src="IMG.gif"  height="170" width="100%" alt="cigarette electronique"/></a>
</xen:if>
test
<!-- FIN DU SCRIPT SLIDER -->

            </div>
              </blockquote>
            </div>
          </div>
      </li>
</xen:if>

it appears in the sub forum :'(

Thanks u for u help
 
@Brogan

Sorry for my English, but if I understand you told me to wrap all the code in the variable, so I made this, but it does not work.


PHP:
<xen:if is="{$forum.node_id} != 23">
<xen:if is="{$post.position} == 0 AND {$conversation.first_message_id} == {$message.message_id}">
    <li class="message">

        <div class="messageUserInfo">
            <div class="messageUserBlock">
                <div class="avatarHolder"><span class="avatar  av2m"><img  src="h1.jpg?1379939746"  width="96px" height="96px"></span></div>

                <h3 class="userText">
                    Monsieur
                    <em class="userTitle" itemprop="title">Pub</em>
                </h3>

                <span class="arrow"><span></span></span>
            </div>
        </div>

      <div class="messageInfo primaryContent">
            <div class="messageContent">
            <blockquote class="messageText ugc baseHtml">
<div align="center">        
<!-- DEBUT DU SCRIPT SLIDER -->
    
    <a href="" onclick="javascript:_paq.push(['trackPageView', '2emepost']);" target="blank"><img src="s2eme.gif"  height="170" width="100%" alt="cigarette electronique"/></a>

<!-- FIN DU SCRIPT SLIDER -->

            </div>
              </blockquote>
            </div>
          </div>
      </li>
</xen:if>
</xen:if>
 
@Brogan

Sorry for my English, but if I understand you told me to wrap all the code in the variable, so I made this, but it does not work.
Let me get straight on what you want - no ads displayed in forum node #23 and all the associated sub-forums under node 23?
If so, I am almost positive that you are going to need an array (refer to this post again).

Something along the lines of an example that @Brogan gives in the resource:
When working with arrays, the ! is placed just before the argument.
For example, <xen:if is="in_array({$forum.node_id}, array(x, y, z))"> for true, <xen:if is="!in_array({$forum.node_id}, array(x, y, z))"> for false.
where (x,y,z) will be the nodes that you do NOT WANT it displayed in.
 
An array is only required if multiple IDs are going to be entered.
As it is, he only wants to stop them showing in one node (23) so the simple condition will suffice: <xen:if is="{$forum.node_id} != 23">
 
An array is only required if multiple IDs are going to be entered.
As it is, he only wants to stop them showing in one node (23) so the simple condition will suffice: <xen:if is="{$forum.node_id} != 23">
@Brogan, I am aware of that but I'm basing the array on his statement of "I would like the advertising does not appear in the forum: 23 and all sub forums: 23" ,which I understood to be inclusive of node 23 and all the nodes he has listed under that one (he gives a more detailed descriptor in post #3 in this topic). In that case (it being more than 1 node) would not an array be required (or multiple statements for each node in the format you provided)?
 
Hmm, I didn't get that from his posts but perhaps you are right.

In which case, perhaps the parent conditional will work (along with the node itself)?
<xen:if is="{$forum.parent_node_id} != x">
 
Hmm, I didn't get that from his posts but perhaps you are right.

In which case, perhaps the parent conditional will work (along with the node itself)?
<xen:if is="{$forum.parent_node_id} != x">
Suggestion... how about adding that nice little snippet into your resource on conditional statements. It's one that I wasn't aware of and probably would be useful to several folks. (y)
 
Top Bottom