We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15861
    • 24 Posts
    I know - I’ve seen this several times throughout the forums but can’t seem to make it work. Basically, I’m creating my own custom iTunes-compatible feeds and am trying to strip the html tags from the post contents.

    The daughter.rss document is cachable. Here’s the call inside the document:

    [[Ditto? &startID=`11` &summarize=`100` &total=`100` &tpl=`itunes_item` ]]
    


    And the template is:

    <item>
        ...
        <description>[!strip_tags? &string=`[+content+]` !]</description>
        ...
    </item>
    


    The strip_tags snippet is:
    <?php
    if (isset($string) && !empty($string)) {
        // Strip the tags from the string passed in.
        $str = strip_tags($string);
        return $str;
    }
    ?>
    


    The snippet is just getting output into the rss file like this:
    <description>[[strip_tags? &string=`<p>You made it! All the way to the end! Congratulations - ...</p></description>
    


    What am I doing wrong here? Or is there a better way to get the html tags out of there?

    Thanks!
      • 7231
      • 4,205 Posts
      It could be a syntax problem in the input string that is breaking the parsing process (cant have some characters like = ), To do what you want it would be easier using the built in PHx functions (PHx is packaged with Ditto for use within tpls). Replace this [!strip_tags? &string=`[+content+]` !] with this:

      [+content:notags+]
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 15861
        • 24 Posts
        That was exactly what I needed. I haven’t explored phx very much yet. That might have to be my next learning item, since I’m getting pretty comfortable with most of the rest of it.


        Thank you!
          • 7231
          • 4,205 Posts
          There are several snippets that have PHx built into their template engines; Ditto, MaxiGallery and Jot to name a few. It is definitely worth checking out. And with custom modifiers you can add basically any function you need very easily. The wiki has a good resource on PHx.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]