Not a bug Inconsistency with "<xen:set var="$newDiscussionButton">"

Jaxel

Well-known member
In the template for "forum_view", the button for for posting threads is as follows:

Code:
<xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a></xen:set>

This set variable is used in both the top control and the below rendered nodes position to control uniformity. This way, throughout the template, any "post new thread" button always has the same values, no matter its position. Anywhere the page wants to render a post new thread button, it simply uses:

Code:
{xen:raw $newDiscussionButton}

However, randomly, at the end of the template, within the "afterDiscussionListHandle" position, it doesn't use the set variable and instead uses a duplication of the code. This seems like a slight oversight.

While it may not seem like a big issue. I am using a template modification to replace the contents of <xen:set>. By not having the consistency in the template, it makes it so I have to make two template modifications to handle a single page, instead of having to only do one... which seems to be against the entire purpose of using a <xen:set> anyways.
 
I'm personally not against changing this, but there might be a specific reason for this that I'm missing, so we'll let Mike confirm. It's also of debatable benefit changing it now. Unless you're only aiming for compatibility with XF 1.5.1 and above with your add-on, you'll need the two template mods anyway.
 
I should probably add that this doesn't really need two template modifications.

If the objective is to replace the contents of the <xen:set> value, if you did a find and replace on the value, which is:
Code:
<a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a>
Then it will handle both of the buttons - the one inside the xen:set and the one that isn't.
 
I don't know if it was explicitly done intentionally. I would guess not, but it was probably done 5 years ago, so it's hard to say.

That said, for the reasons noted, I don't think it particularly needs to be changed. Indeed, there may even be reasons where people are targeting the top button only and a change here would break that.
 
Top Bottom