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

Fixed TMS does not inject code correctly

Discussion in 'Resolved Bug Reports' started by Adam Howard, Sep 18, 2013.

  1. Adam Howard

    Adam Howard Well-Known Member

    OK applying this code manually into the template will give me a nice red heart next to any like given.

    extra.css

    PHP:
    /* Add heart next to like */
    .LikeText:before {
    content"\2665 \0020";
    color#FF0000;
    font-size1.5em;
    margin0 0 0 2px;
    }
    /* END Add heart next to like */
    But when I have TMS add it; the result is something like this

    www.sociallyuncensored.eu 2013-9-18 12 37 40.png

    So the code works... You can verify that by adding it to extra.css and liking a post. But for some reason TMS spits it out wrong.
     
  2. Mike

    Mike XenForo Developer Staff Member

    As you're doing a regex, this is another method of replacing backreferences (from preg_replace). Use \\.

    I don't think I can necessarily change this behavior due to backwards compatibility.
     
    SneakyDave likes this.
  3. Adam Howard

    Adam Howard Well-Known Member

    This is what I'm currently trying to apply

    Screenshot from 2013-09-18 13:16:24.png


    Exactly what are you suggesting as an alternative?
     
  4. Adam Howard

    Adam Howard Well-Known Member

    I solved this.

    You were talking about my code. Your "hint" was so vague I kept thinking you were suggesting about the code used in the "find" box.
     
  5. Mike

    Mike XenForo Developer Staff Member

    I have now documented that backslashes should be escaped in the replacement content if using a regular expression match.
     
    Adam Howard likes this.
  6. Adam Howard

    Adam Howard Well-Known Member

    Just for a point of reference for anyone who may run into this problem & find this via google...

    Was

    PHP:
    /* Add heart next to like */
    .LikeText:before {
    content"\2665 \0020";
    color#FF0000;
    font-size1.5em;
    margin0 0 0 2px;
    }
    /* END Add heart next to like */
    Now

    PHP:
    /* Add heart next to like */
    .LikeText:before {
    content"\\2665 \\0020";
    color#FF0000;
    font-size1.5em;
    margin0 0 0 2px;
    }
    /* END Add heart next to like */
    ^ Basically \ turns into \\
     

Share This Page