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

XenForo template editor should have better highlighting support for XenForo template syntax

Brad Padgett

Well-known member
#1
<xf:if is="$options.staffOnline">
<xf:if contentcheck="true">
<div class="block" data-widget-section="staffMembers"{{ widget_data($widget) }}>
<div class="block-container">
<h3 class="block-minorHeader"><a href="{{ link('members', null, {'key': 'staff_members'}) }}">{{ phrase('staff_online') }}</a></h3>
<ul class="block-body">
<xf:contentcheck>
<xf:foreach loop="$online.users" value="$user">
<xf:if is="$user.is_staff">
<li class="block-row">
<div class="contentRow">
<div class="contentRow-figure">
<xf:avatar user="$user" size="xs" />
</div>
<div class="contentRow-main contentRow-main--close">
<xf:username user="$user" rich="true" />
<div class="contentRow-minor">
<xf:usertitle user="$user" />
</div>
</div>
</div>
</li>
</xf:if>
</xf:foreach>
</xf:contentcheck>
</ul>
</div>
</div>
</xf:if>
</xf:if>

<div class="block" data-widget-section="onlineNow"{{ widget_data($widget) }}>
<div class="block-container">
<h3 class="block-minorHeader"><a href="{{ link('online') }}">{$title}</a></h3>
<div class="block-body">
<xf:if contentcheck="true">
<div class="block-row block-row--minor">
<h4 class="block-textHeader block-textHeader--scaled">
{{ phrase('people_you_follow') }}
</h4>
<ul class="listHeap">
<xf:contentcheck>
<xf:if is="$options.followedOnline">
<xf:foreach loop="$online.users" value="$user">
<xf:if is="in_array($user.user_id, $xf.visitor.Profile.following)">
<li>
<xf:avatar user="$user" size="xxs" img="true" />
</li>
</xf:if>
</xf:foreach>
</xf:if>
</xf:contentcheck>
</ul>
</div>

<div class="block-row block-row--minor">
<h4 class="block-textHeader block-textHeader--scaled">
{{ phrase('members') }}
</h4>
<xf:else />
<div class="block-row block-row--minor">
</xf:if>

<xf:if is="$online.users is not empty">
<ul class="listInline listInline--comma">
<xf:foreach loop="$online.users" value="$user"><xf:trim>
<li><xf:username user="$user" rich="true" class="{{ !$user.visible ? 'username--invisible' : '' }}" /></li>
</xf:trim></xf:foreach>
</ul>
<xf:else />
{{ phrase('no_members_online_now') }}
</xf:if>
</div>
</div>
<div class="block-footer">
<span class="block-footer-counter">{{ phrase('online_now_x_members_y_guests_z',{
'total': number($online.counts.total),
'members': number($online.counts.members),
'guests': number($online.counts.guests)})
}}</span>
</div>
</div>
</div>


Hey I recently was editing widget_members_online in a different style then the default and as I was I noticed after reverting the areas above highlighted in red were highlighted in red inside of the template. But it wasn't because I reverted because I changed it to the default untouched style to see and the areas were still highlighted by the template editor as if there was to be an error but the template was untouched.


I highlighted in red in the code above which errors were highlighted by the editor.

Let me know what you think. Thanks.

EDIT: I couldn't use the code tags because it wouldn't let me highlight the area so I just undid them just now.
 

Chris D

XenForo developer
Staff member
#2
There's unfortunately not a great deal we can do about this in the short term. It's due to our template syntax not being totally valid HTML in some cases so it can cause our template editor to complain when it starts to think certain tags haven't been closed, etc.

Longer term we would be looking to add the definitions to the code editor so it can understand our template syntax better and avoid displaying these as syntax errors.

With that in mind, I'll move this to Suggestions for now.
 

Brad Padgett

Well-known member
#3
There's unfortunately not a great deal we can do about this in the short term. It's due to our template syntax not being totally valid HTML in some cases so it can cause our template editor to complain when it starts to things certain tags haven't been closed, etc.

Longer term we would be looking to add the definitions to the code editor so it can understand our template syntax better and avoid displaying these as syntax errors.

With that in mind, I'll move this to Suggestions for now.
Okay sure that sounds good. It's just hard sometimes to know if you've made a mistake with the code or if the code is the original template. But with that said, I can see that there aren't any mistakes in the code so that's not a problem. I'll just make note of the way it's supposed to look. Appreciate the reply.