Pages, but with template conditionals?? How to?

Rob

Well-known member
Hi,

On my existing site (vb) I have what we call sponsor profiles. These are just pages with information about the sponsor, twitter and facebook widgets etc. On vB, I accomplished this with a basic php page to pull the content from specific templates set up in the admin area.

Now, on xenForo I would like to use the pages functionality, however, some sponsor profiles need template conditionals to show/hide content to members and non members.

My question is, whats the best way of achieving this on xenForo? I would like to pull the content from templates so I can use the template conditionals but I don't know how to go about that. I would assume it is impossible to use conditionals in 'pages' so the templates way seems the best way.

I was trying to avoid having to create a new php file each and every time I want to add a sponsor profile and I was also hoping I could set a route for each page too...

Does anyone have any ideas?
 
Pages support HTML and XenForo syntax, so you can use conditional statements.

Or you can do it using templates.

Either approach works.
 
Pages support HTML and XenForo syntax, so you can use conditional statements.

Or you can do it using templates.

Either approach works.

Does using conditionals still work on pages for XF1.5? They don't seem to work for me -- the only conditional that seems to work is if they're logged in or not. Using specific usergroup conditional doesn't work so I'm wondering if I'm doing something wrong.

For instance, this works when it comes to deciding what to show to guest or logged in users:

Code:
<xen:if is="{$visitor.user_id}">
Hi there, logged in member!
<xen:else />
Oops! You need to be logged in to see this.
</xen:if>

...but when adding usergroups, it doesn't work, goes to straight to Oops!

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 14, 15}">
Hi there premium member!
<xen:else />
Oops! You need to be logged in as premium member to see this.
</xen:if>

Is there something else I need to do?

Thanks!
Ray
 
UPDATE: I *think* I have this sorted out -- killing cache, using private browsing in a completely separate test account (and not using test permissions like I was...) shows it appears to be working. It's been sooo random! :sneaky:

Ray
 
Top Bottom