We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44920
    • 48 Posts
    Hi,

    i'm using SimpleSearch on my website. would it be possible to strip modx tags which i use within content (e.g. as "Learn more" button or similar)?

    [[$HtmlLearnMoreLink? &url=`[[~57]]` &title=`Some Title` &name=`en_57` &id=`en_57`]]


    EDIT:
    ok, tags itself are actually stripped. what's not stripped are parameters / attributes. i can see in search results
    Some content text &title=`Some Title` &name=`en_57` &id=`en_57`


    thank you in advance
    kr. [ed. note: krajicek last edited this post 10 years, 5 months ago.]
      MODX Revolution 2.2.8-pl (advanced)

      Extras:
      archivist 1.2.4 | Articles 1.7.1 | Babel 2.2.5 | getpage 1.2.3 | getresources 1.6.0 | quip 2.3.3 | SimpleSearch 1.6.1 | taglister 1.1.7 | TinyMCE 4.3.3 | Wayfinder 2.3.3

      PHP Version 5.6.20-0
      MySQL Version 5.5.31
    • Try an Output Modifier:
      [[+extract:stripstring=`[[$HtmlLearnMoreLink? &url=`[[~57]]` &title=`Some Title` &name=`en_57` &id=`en_57`]]`]]

      If the inner `` delimiters cause a problem, then use a Property Set for the chunk.
      [[+extract:stripstring=`[[$HtmlLearnMoreLink@hlmlPropertySet]]`]]

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 44920
        • 48 Posts
        Quote from: sottwell at Oct 29, 2013, 10:26 AM
        Try an Output Modifier:
        [[+extract:stripstring=`[[$HtmlLearnMoreLink? &url=`[[~57]]` &title=`Some Title` &name=`en_57` &id=`en_57`]]`]]

        If the inner `` delimiters cause a problem, then use a Property Set for the chunk.
        [[+extract:stripstring=`[[$HtmlLearnMoreLink@hlmlPropertySet]]`]]


        Thank you, Susan,

        helpful as always smiley

        gonna try your advice.
          MODX Revolution 2.2.8-pl (advanced)

          Extras:
          archivist 1.2.4 | Articles 1.7.1 | Babel 2.2.5 | getpage 1.2.3 | getresources 1.6.0 | quip 2.3.3 | SimpleSearch 1.6.1 | taglister 1.1.7 | TinyMCE 4.3.3 | Wayfinder 2.3.3

          PHP Version 5.6.20-0
          MySQL Version 5.5.31
          • 40833
          • 52 Posts
          This is a pretty old thread, but I just had this issue with SimpleSearch and wanted to help by adding my solution. While Susan’s Property Set solution works (I assume, I haven't tried it), it is rather an impractical method if you have a large site with many different MODx tags within the content.

          I simply wrote an output filter for the extract - (i.e. [[+extract:stripMODxTags]]).

          The "stripMODxTags" snippet:
          $output = (string) $input;
          $regx = '/`[\w\W^`]+`/i'; // strip anything between ticks including ticks (``)
          $output = preg_replace( $regx, '', $output );
          $regx = '/\&(amp;)?[a-zA-Z0-9_\-\.\?^\=]+\=/i'; // strip remaining tag qualifiers ( &tag= )
          $output = preg_replace( $regx, '', $output );
          return $output;


          This seems to work fairly well (we’ll see, I just wrote it). I’m not really a Regular Expression guru and I haven’t extensively tested this, so if anyone has improvements to the Regular Expressions, that would be welcome. Thanks!