Our template syntax for conditionals currently only supports simple equality checks, but we plan to extend it in the near future.Ok tnx. Another one we use is <if condition="in_array($GLOBALS[forumid], array(25,118,120,121,126,139,140))">
I assume the same differences apply?
Our template syntax for conditionals currently only supports simple equality checks, but we plan to extend it in the near future.
<xen:if is="'{$forum.node_id} == 8' AND '{$forum.node_id} == 2'">
<xen:if is="'{$forum.node_id} == 8' && '{$forum.node_id} == 2'">
<xen:if is="{$forum.node_id} == 8 OR {$forum.node_id} == 2">
I think you need OR, not AND. The logic you posted there can never evaluate to true - how can the node_id ever be 8 AND 2?
Additionally, you don't need to individually quote each clause, that would turn the checks into strings instead of logic.
Try this instead:
HTML:<xen:if is="{$forum.node_id} == 8 OR {$forum.node_id} == 2">
The concept of THIS_SCRIPT from vBulletin doesn't really work in XenForo as the mechanism by which a page us built is so drastically different. However, Mike and I are investigating ways to expose some data from the controller and view layers that will hopefully give you tools to achieve what you want.
$fc->route()->getControllerName() != 'XenForo_ControllerPublic_Index'
I think we already expose the controller name to the template, but I'd have to double check that.Depending on how complicated you were willing to get, you could create an addon that does something based on:
Code:$fc->route()->getControllerName() != 'XenForo_ControllerPublic_Index'
if ($controllerResponse)
{
$this->_defaultTemplateParams['controllerName'] = $controllerResponse->controllerName;
$this->_defaultTemplateParams['controllerAction'] = $controllerResponse->controllerAction;
$this->_defaultTemplateParams['viewName'] = $controllerResponse->viewName;
}
<p class="importantMessage">
controllerName: {$controllerName}, controllerAction: {$controllerAction} and viewName: {$viewName}.
</p>
If you want to show an ad only in forum id 1, use this:So what's the code for showing for example an ad only in forum ID 1 ? Or is that still not possible? The THIS_SCRIPT alternative isn't entirely clear to me either?
Oops, fixed.kier ... </xen> should probably be </xen:if>
This one doesn't seem to be working on my test forums.If you want to show an ad only in forum id 1, use this:
<xen:if is="{$forum.node_id} == 1"><!-- ad code here --></xen:if>
We use essential cookies to make this site work, and optional cookies to enhance your experience.