Conditional Statements

Conditional Statements

If I wanted to set a no-index tag on all forum_view pages except for the first page, would that be something I could accomplish with a conditional statement?

Code:
<xen:if is="???????">
  <xen:container var="$head.robots">
  <meta name="robots" content="noindex, follow" />
  </xen:container></xen:if>

For example, this page would be indexed. Subsequent pages (2,3,4...)would have the noindex tag applied.
 
Is there a way to display content on the first new post of a thread, and then the first post on subsequent pages?

I'm trying to remove an add-on.
 
Is there a way to display content on the first new post of a thread, and then the first post on subsequent pages?

I'm trying to remove an add-on.

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
Ads goes here...
</xen:if>
 
Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
Ads goes here...
</xen:if>

That is an option, but when a logged-in user clicks on a thread they are taken to the first unread post. If they are logged in that is where I want to put the ad, otherwise the first post of the page is fine.

Couldn't see an example in the guide that could help. Is there something I'm missing?
 
i'm running into problems trying to display child forum titles on my main page. i know where to edit it (node_forum_level_2), and what to add:
Code:
                <xen:if is="{$renderedChildren} AND {$level} == 2">
                            <ol class="secondaryContent">
                            <xen:foreach loop="$renderedChildren" value="$child">
                                {xen:raw $child} 
                            </xen:foreach>
                            </ol>
                </xen:if>

but the issue is that when outputting the xen:raw $child piece, it will automatically add a return stroke / new line /new row to the output. more specifically, i'm trying to do:
<parent title> <child title>

but the xen:raw is forcing it to look like:
<parent title>
<child title>

simply using $child outputs the html code, and it looks like "xen:raw" is what's responsible..

i saw a similar question asked here:
https://xenforo.com/community/threads/xen-raw-inside-templates.21653/
..which references this source for an answer, however, i'm not seeing a connection on how to a.) edit the "raw" conditional, or b.) create an alternative solution to preventing the return stroke.

thoughts?
 
Have you tried wrapping the output in a div or span and applying float?
no such luck.
let me elaborate a bit more.. in node_forum_level_2, the following is where the parent title/link is output:
Code:
<a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a></h3>
which, in my forum, outputs:
upload_2014-12-10_10-20-39.webp

in an attempt to narrow down my problem, i tried the most basic test and changed that part of the code to:
Code:
<a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a>test</h3>
which returns:
upload_2014-12-10_10-21-17.webp

...the word "test" gets appended to the forum title (which is what i want and would expect). however, when trying to output $child here, i get:
Code:
<a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a><xen:foreach loop="$renderedChildren" value="$child">{xen:raw $child}</xen:foreach></h3>
upload_2014-12-10_10-23-36.webp

and upon trying your suggestion above, i get:
Code:
<a href="{xen:link forums, $forum}" data-description="{xen:if @nodeListDescriptionTooltips, '#nodeDescription-{$forum.node_id}'}">{$forum.title}</a><xen:foreach loop="$renderedChildren" value="$child"><span class="xt-custom-children-child">{xen:raw $child}</span></xen:foreach></h3>

with:
.xt-custom-children-child {
    float: top;
}
upload_2014-12-10_10-27-4.webp

likewise, when changing the float to "right", i get:
upload_2014-12-10_10-26-30.webp
...but note that this isn't stemming from the title "Music" in any way -- i tested changing "Music" to the max 50 characters, and "Album Discussion" will just drop down further.
 

Attachments

  • upload_2014-12-10_10-25-55.webp
    upload_2014-12-10_10-25-55.webp
    1.7 KB · Views: 1
What xenforo conditional to use if I want to target mobile only?

I want to load specific script on mobile user's only. Not using css media queries.
 
I'm trying to add the nofollow meta tag to all thread pages in specific nodes along with the parent node and parent category.

How would i do this?
 
Hello.

From a helper, I get true or false returned.

In my template, I have the following dumb test:

<xen:if is="{$valid} == true">
valid
<xen:else />
invalid
</xen:if>

but I always get the "valid" message, no matter if $valid is true or false. Also,

<xen:if is="{$valid}">
valid
<xen:else />
invalid
</xen:if>

Also it doesn't matter if my helper returns 0 / 1 / "true" / "false" etc.

Someone knows why I never get a "invalid" message, even if my $valid variable contains false?

I am laming around since one hour to get this simpliest condition done.
 
I'm trying to just add an advertisement to the ad_above_content template for my themes. I'm adding the following code for just guests and registered members, but it's not showing up

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 1, 2}">
media.net ad code here
</xen:if>

<xen:hook name="ad_above_content" />

Is that right?

I tried it on the default theme as well with no success
 
Top Bottom