We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37984
    • 215 Posts
    Hi everyone. I've not played with Evo a lot, and I'm a front-end guy so my PHP skills are quite minimal. However, I'm trying to write a custom snippet to strip all link tags from the [*content*] placeholder in one of my templates. All other html tags should remain. Here is my attempt thus far:

    The snippet call:

    [!strip_links? &string=`[*content*]`!]


    The strip_links snippet:

    <?php
    $stringtostrip = $scriptProperties['string']; 
    $stringtostrip = 
        preg_replace(array('"<a href(.*?)>"', '"</a>"'), array('',''), $stringtostrip);
    ?>


    Please forgive if I'm WAY off, as I said, my skills are not the greatest. If this was Revo, I'd just use an output filter.
      Jesse Couch
      MODX Aficionado, Front-End Designer & Developer
      http://www.designcouch.com
      • 9995
      • 1,613 Posts
      Need to awnser this very fast, shuting donw here, does [*content:notags*] work?
        Evolution user, I like the back-end speed and simplicity smiley
        • 37984
        • 215 Posts
        Quote from: fourroses666 at May 30, 2013, 11:06 AM
        Need to awnser this very fast, shuting donw here, does [*content:notags*] work?

        Thanks for the reply, but no it didn't work - that removes all tags, not just anchors.

        I've actually devised a solution using a custom PHx modifier. For reference sake, here it is:

        The call:

        [*content:striplinks*]


        The phx:striplinks snippet:

        <?php
        $string = preg_replace('/<a[^>]+>([^<]+)<\/a>/i','\1',$output);
        return $string;
        ?>


        Should be noted that this requires PHx be installed (It is on my site).
          Jesse Couch
          MODX Aficionado, Front-End Designer & Developer
          http://www.designcouch.com