Conditional Statements

Conditional Statements

Hi Brogan,
I've made a custom Template called "gp_container" and have called it into the header template just below the </header> tag. I did this because I want this HTML to be right below the header and for the DIV not to be contained by the content area container. Since I placed it in the header template, I need a conditional that will say "IF a user is on this page show this html else show nothing"

Hope this better explains what I'm trying to accomplish.

Edit:
So I looked over this page:
https://xenforo.com/community/resources/using-variables-in-templates.5034/update?update=18416

And since using the code:
{xen:helper dump, $page.node_id}

Is returning a value of NULL, I guess I can't add the variable to the header template?
 
Last edited:
Ok, so I did some hunting and found that I could use the URI since the variable page.node_id was not available.
Code:
<xen:if is="{$requestPaths.requestUri} == '/members/admin.1/'">

</xen:if>
 
I want to display something on profile of members in a specific usergroup. Will this work?
<xen:if is="{$user.user_group_id} == x">
 
I need to base the conditional on the profile owner. Not the visitor.
Doesn't that conditional relate to the visitor of the page?
 
Hi,

I'm struggling to show content in the resource_view_header of resources in a specific resource category only.

I tried this in the resource_view_header template:

Code:
<xen:if is="{$resource_category_id} == x">...</xen:if>

But no luck :(

Any help would be very much appreciated.

Thanks
 
Is it possible to use conditionals in EXTRA.css?

For example I would like to show some things just to mods and admins, but not to the rest of the users.
I know I can do this in templates, but I would like to know if it's possible to also do it in extra.
 
Don't think it is possible in CSS templates other than small stuff like only coloring a certain node using the node ID.
 
Is it possible to use conditionals in EXTRA.css?

For example I would like to show some things just to mods and admins, but not to the rest of the users.
I know I can do this in templates, but I would like to know if it's possible to also do it in extra.
I used some conditionals in css in my add-on.
 
Is there a conditional that would allow me to show all other users content based on the author? So if user 1 is the author of the thread, it would show x content to all users and if user 2 is the author of the thread it would show y content to all users.
 
Thank you for this resource!

I am using the widget framework and I can set certain expressions for displaying widgets in the following format:
Code:
XenForo_Template_Helper_Core::callHelper('ismemberof', array($visitor,3))

This looks different than the format you are using. What's the difference?

How would I hide widgets for a specific user group like this:

Code:
<xen:if is="!{xen:helper ismemberof, $visitor, x}">
This content will be hidden from members of user group x
</xen:if>

But in the proper expression format for the Widget Framework?

Thank you!

M
 
Hi,
I just want to display an image, if the path is in the variable.
Well with:
Code:
<xen:if is="{$item.previewImg}"><img src="{$item.previewImg}"></xen:if>

or

Code:
<xen:if is="{$item.previewImg} != ' '"><img src="{$item.previewImg}"></xen:if>

it displays all images even the empty ones with the source (" "). I used trim on php function but it every value has those strange spaces/tabs.

So, is there a helper function using trim on a variable oder any other useful functions?

Thx!
 
Top Bottom