XF 1.1 IF statement to display specific content.

zagman76

Active member
When I was using vB, I was able to add an 'if' statement to only display certain content (ads) in specific forums. Actually, it was configured to NOT display the ads in specific forums (to comply with the AdSense rules).

Is there a similar method in XenForo? In addition, can it be combined to also not show for specific user groups?

Here is what I was using on vB:
Code:
<vb:if condition="!in_array($GLOBALS[forumid], array(23,29,32,40,49,62,76,84,99,101))">

Thanks!
 
Somewhat off topic, but I was just curious if the following is also considered correct/valid:
PHP:
<xen:if is="{$message.canReport} OR {$message.canEdit}">

Thanks
 
Hi TrevC,

This all depends on where you want to use those conditionals.

Some templates might not have the $message parameter available. In fact, some templates instead use the $post variable.

Other templates might even use specific variables passed from the controller... I'm pretty sure I've seen {$canReply} before now...

Best bet is, to try a conditional, if it doesn't work then specifically make a new thread somewhere detailing exactly what conditional you're trying to put in which template and ultimately what you hope to achieve and hopefully we will be able to work out a solution.

Some things unfortunately need custom PHP to be written.
 
Thanks. It's working. Must've been used in the correct context. :)

We have a large portion of iOS and Mac users, so I've been reworking the public and private controls on posts with better touch targets and a more modern UI.
Screen Shot 2012-11-21 at 22.14.41.webp


The private controls are toggled by clicking the cog.
Screen Shot 2012-11-21 at 22.15.15.webp

Icons, spacing, sizing, etc is not refined or complete. Actually, the design still has a way to go.
Our CSS is already smaller/faster than the original Xenforo stuff.

I love Xenforo, but I've never been a fan of how template editing is handled, or any of the stock design & styles.
 
Thanks. I'm happy with it so far. The pages render quicker too.

I'd release a generic version if it were possible, but there's tons of templates modded, markup stripped back, re-structuring and renaming. The CSS loads as a single minified file, the stock Xen CSS loading is all removed from the templates. In re-writing the CSS (Sass), the emphasis was placed on fast performance for webkit/mobile Safari. We're also only supporting IE9+ (though IE8 still works quite well).

There's only two raster images in use, the rest is a custom webfont.

"Speed is a feature" :)
 
Top Bottom