<xf:if is="$forum.node_id != xx">
however this is not working hiding from a page node so I presume I need something other than $forum.node_id
. I tried $page.node_id
but no luck.<xf:if is="$page.node_id != 94">
<li>
<xf:macro name="nav_entry" arg-navId="{$navId}" arg-nav="{$navEntry}" arg-shortcut="alt+{$i}" />
</li>
</xf:if>
I have a conditional working fine to hide content from a forum node<xf:if is="$forum.node_id != xx">
however this is not working hiding from a page node so I presume I need something other than$forum.node_id
. I tried$page.node_id
but no luck.
For example, to hide the sub navigation links on a page node:
Code:<xf:if is="$page.node_id != 94"> <li> <xf:macro name="nav_entry" arg-navId="{$navId}" arg-nav="{$navEntry}" arg-shortcut="alt+{$i}" /> </li> </xf:if>
I'm sure this must be easy but is eluding me.
Can anyone please help?
Thank you.
$__globals.forum.node_id
You can see what variables are available for the template you are adding that code in by putting this into the template:I have a conditional working fine to hide content from a forum node<xf:if is="$forum.node_id != xx">
however this is not working hiding from a page node so I presume I need something other than$forum.node_id
. I tried$page.node_id
but no luck.
For example, to hide the sub navigation links on a page node:
Code:<xf:if is="$page.node_id != 94"> <li> <xf:macro name="nav_entry" arg-navId="{$navId}" arg-nav="{$navEntry}" arg-shortcut="alt+{$i}" /> </li> </xf:if>
I'm sure this must be easy but is eluding me.
Can anyone please help?
Thank you.
{{ dump(vars()) }}
Thanks, but how do I use that?You can see what variables are available for the template you are adding that code in by putting this into the template:
{{ dump(vars()) }}
I take it that this that you triedThanks, but how do I use that?
<xf:if is="$page.node_id != 94">
is placed in a loop. If so, after the </xf:foreach>
for that loop paste in {{ dump(vars()) }}
and save. When you visit the Page, all the available variables for that template will be displayed.OK, so I have this:I take it that this that you tried<xf:if is="$page.node_id != 94">
is placed in a loop. If so, after the</xf:foreach>
for that loop paste in{{ dump(vars()) }}
and save. When you visit the Page, all the available variables for that template will be displayed.
<ul class="p-sectionLinks-list">
<xf:foreach loop="$selectedNavChildren" key="$navId" value="$navEntry" i="$i">
<xf:if is="$page.forum.node_id != 94">
<li>
<xf:macro name="nav_entry" arg-navId="{$navId}" arg-nav="{$navEntry}" arg-shortcut="alt+{$i}" />
</li>
</xf:if>
</xf:foreach>{{ dump(vars()) }}
</ul>
<ul class="p-sectionLinks-list">
<xf:foreach loop="$selectedNavChildren" key="$navId" value="$navEntry" i="$i">
<xf:if is="$__globals.forum.node_id != 94">
<li>
<xf:macro name="nav_entry" arg-navId="{$navId}" arg-nav="{$navEntry}" arg-shortcut="alt+{$i}" />
</li>
</xf:if>
</xf:foreach>{{ dump(vars()) }}
</ul>
There is no $page, as I suspected, so in your if statement use: $containerKey != 'node-94'
edit: oops !=
<xf:if is="!$xf.visitor.user_id">
Show only members
<xf:else />
Show only guests
</xf:if>
For some reason this works opposite it says on my site.
Code:<xf:if is="!$xf.visitor.user_id"> Show only members <xf:else /> Show only guests </xf:if>
The Show to guests shows to members and show to members shows to guests. Hmmm.. I just reversed what I wanted to do and it works fine.
!$xf.visitor.user_id
means if visitor does NOT have an ID.Then the FAQ is wrong then. That makes sense. Thank you!!$xf.visitor.user_id
means if visitor does NOT have an ID.
Remove the ! and it should work as intended
i solved this in message_macrosHow display custom user group banner on some nodes only ?
<xf:if is="in_array({$__globals.forum.node_id}, [33,34]) AND {$user.isMemberOf('22')}">
<div class="userBanner userBanner--lightGreen message-userBanner">name</div>
</xf:if>
<xf:if is="$post.position % $xf.options.messagesPerPage == 0">
<div style="text-align:center;">
{your code}
</div>
</xf:if>
For after 8th post:
<xf:if is="$post.position % $xf.options.messagesPerPage == 7">
For after 18th post:
<xf:if is="$post.position % $xf.options.messagesPerPage == 17">
We use essential cookies to make this site work, and optional cookies to enhance your experience.