XF 2.1 Template Modifications For Different XF Versions

Ozzy47

Well-known member
Okay,for the conversation_add template, I have a template modification set up. It works in XF2.1.2, but not in XF2.1.3.

I can fix it for 2.1.3 no problem, but then it won't work for 2.1.2.

So the question is, is their a way to write the find and the replace to accommodate two different versions?

2.1.2 Find:
HTML:
            <xf:tokeninputrow name="recipients" value="{$to}" href="{{ link('members/find') }}"
                rowtype="fullWidth"
                label="{{ phrase('recipients') }}"
                explain="{{ phrase('separate_names_with_comma') }}" />

2.1.3 Find:
HTML:
            <xf:tokeninputrow name="recipients" value="{$to}" href="{{ link('members/find') }}"
                rowtype="fullWidth"
                label="{{ ($maxRecipients == -1 OR $maxRecipients > 1) ? phrase('recipients') : phrase('recipient') }}"
                max-tokens="{{ ($maxRecipients > -1) ? $maxRecipients : null }}"
                explain="{{ ($maxRecipients == -1 OR $maxRecipients > 1) ? phrase('separate_names_with_comma') : null }}" />
 
Heh, I actually just responded to your PM about this, but for everyone's benefit, I came to the same answer as @Kirby and you can actually do this one fairly elegantly so it works with both versions.

XF 2.1.2:

XF 2.1.3:
 
Some people (@Mike :rolleyes:) have some sort of weird gift where they can write the most complicated (and perfect) regular expression, off the top of their heads, without any testing being required and it just works.

The rest of us have to use tools like regex101 ;)

There are many other tools out there, but regex101 has been my favourite for years now.
 
Some people (@Mike :rolleyes:) have some sort of weird gift where they can write the most complicated (and perfect) regular expression, off the top of their heads, without any testing being required and it just works.

To get there, you don't just have to write regex, you have to live them.
 
I also often write (simple) regexes without having to test them, but for more complex ones Regex101 is a lifesaver for sure :)
 
So the question is, is their a way to write the find and the replace to accommodate two different versions?
I had the same request some time ago. Another way is to use a callback in your template, which is only called during compilation.
For me, that was much easier then using regex ;)

 
I had the same request some time ago. Another way is to use a callback in your template, which is only called during compilation.
For me, that was much easier then using regex ;)


I'll keep that in mind as well, thanks for the link. :)
 
Back
Top Bottom