querschlaeger
Member
Hello,
I created a very simple Code Event Listener to extend a template:
Works without a problem. But how can I use Conditional Statements here?
This does not work (show the text to guests only):
Is there a way to get the content of $visitor object?
I created a very simple Code Event Listener to extend a template:
PHP:
<?php
class Demo_Listener
{
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
switch($hookName)
{
case 'ad_above_content':
{
$contents .= 'Lorem Ipsum';
break;
}
}
}
}
Works without a problem. But how can I use Conditional Statements here?
This does not work (show the text to guests only):
PHP:
<?php
class Demo_Listener
{
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
switch($hookName)
{
case 'ad_above_content':
{
$contents .= '<xen:if is="!{$visitor.user_id}">Lorem Ipsum</xen:if>';
break;
}
}
}
}
Is there a way to get the content of $visitor object?