1. 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

Discussion in 'XenForo Questions and Support' started by Rigel Kentaurus, Jul 29, 2013.

  1. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    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?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    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
     
  3. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    It requires delimiter and modifier? That is weird.
    Let me try ...
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  5. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    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
     
    Hoffi and Chris D like this.

Share This Page