1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check Existence of Add-on/Option Definition in Template Syntax

Discussion in 'XenForo Development Discussions' started by Teapot, Jan 2, 2013.

  1. Teapot

    Teapot Well-Known Member

    My style is currently split up into multiple EXTRA.css files for clarity. However, I've also realised that doing that allows me to check for style property settings before including the CSS - for example, I have a "large avatars" option that's toggled by a style property:
    /* Optional: Large Avatars on Posts */
    <xen:if is="@largeAvatars">
        <xen:include template="EXTRA_largeavatars.css" />
    What I would love, though, is to be able to do the same to check the presence of an add-on - XenPorta, Responsive Design, User Online Status, etcetera. Is there the ability to check for whether an addon exists in template syntax, or alternately check the value of an option? For example: [RT] Status Online Ribbon has a displayOnlineLocation setting in Options. If that exists, I need to modify the CSS slightly to make it work with my large avatar hack.

    If I can check whether that setting exists/is set, I can include my hack for the addon if it exists, and leave it out if it isn't. The main reason I'm interested is because I have several thousand lines of custom CSS - and serving (for example) XenPorta styles when the user doesn't have XenPorta installed seems like a waste of bandwidth - and thus, precious loading time.

Share This Page