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

    my output-filter just doesn’t work anymore.

    // code from my template
    // should result the meta-description
    // should strip html-tags from content and limit to 175 characters
    // actually doesn't stripTags but limits to 175 characters
    
    [[*content:stripTags:strip:limit=`175`]]


    outputs:
    <meta name="description" content="<article class=" referenz"="">

    any suggestions?
    Working with 2.0.7pl
      MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
      • 21838
      • 284 Posts
      Okay, it’s a bit confusing. RTFM says two types of the Output modifier: as modifier it’s named "stripTags,notags" and in example it is used as: ":strip_tags".
      But both or all three types don’t work for me.
        MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
        • 11076
        • 159 Posts
        Try:
        [[*content:strip_tags:limit=`175`]]



          Michael Shraibman( gOmp)  | Freelance Design & Development | wink  impossible is nothing...
          • 21838
          • 284 Posts
          I’ve already written above that it just doesn’t work. Tags are not stripped.
            MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
            • 11076
            • 159 Posts
            Quote from: smooth-graphics at Jan 23, 2011, 06:08 AM

            I’ve already written above that it just doesn’t work. Tags are not stripped.
            my bad, didn’t notice, sorry.

            I’ve checked it and for me it works as it should (on 2.0.7-PL).
            nothing changed on the core/model/modx/filters/modoutputfilter.class.php

            considering the limit-filter you are using for placing this data to the meta description tag,
            i think instead of cutting the words at the 175th char, it’s better keep them whole using this filter/snippet (WholeWords):
            <?php
            $output = '';
            $input = strip_tags($input);
            if (!empty($input) && !empty($options)) { 
            	if (strlen($input) > $options) {
            	       $output = substr($input, 0, strrpos(substr($input, 0, $options), ' '));
            	} else $output = $input;
            }
            return $output;

            then you can use it as a filter:
            [[*content:WholeWords=`175`]] 

            or better (=faster) as a snippet:
            [[WholeWords? $input=`[[*content]]` $options=`175`]]

              Michael Shraibman( gOmp)  | Freelance Design & Development | wink  impossible is nothing...
              • 21838
              • 284 Posts
              Yeah, thank you for the snippet but for me the output filter :strip_tags is not working even if it’s the only one I use.
              But I now have the ressource or another snippet (getRessoureces) running in it in suspection as it works on other ressources.

              //edit: I definitely know now that the error or misfunction of the output filter is about getRessources.
                MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)