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

XF 1.2 Template modification - Add content at the end

Rigel Kentaurus

Well-known member
#1
This should be a very basic question, I am trying to add content at the end of the template

I figured I could that with Regex, however, when I set it up as ..

Regular Expression:
Code:
^(.*)$
Substitution:
Code:
$0 MY_CONTENT
That does not work. It tells me the Regex is not valid. What is the correct way of doing this?
 

Chris D

XenForo developer
Staff member
#2
This is what I have been using:

Code:
/<dl class="ctrlClass">(.*?)<\/dl>/is
Replace:

Code:
$0 YOUR_CONTENT
I think the thing missing from your regular expression is the delimiter and modifier. So I wonder if this works:

Code:
/^(.*)$/is
 

Rigel Kentaurus

Well-known member
#3
This is what I have been using:

Code:
/<dl class="ctrlClass">(.*?)<\/dl>/is
Replace:

Code:
$0 YOUR_CONTENT
I think the thing missing from your regular expression is the delimiter and modifier. So I wonder if this works:

Code:
/^(.*)$/is
It requires delimiter and modifier? That is weird.
Let me try ...
 

Chris D

XenForo developer
Staff member
#4
It's not weird. PHP regex always requires delimiter and modifier.

Unless you mean you feel XF should apply one automatically. In which case this way gives us more control, I guess.
 

Rigel Kentaurus

Well-known member
#5
Yeah, I would've expected XF to add that for me. My reasoning is that the user should not be aware of the language underneath. I use regexes on my text editor all the time, I don't care if the text editor is implemented in perl, python, or C :)

Anyway, thanks. That worked like a charm.
Code:
/^(.*)$/is
that works