We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30546
    • 46 Posts
    I did a bit of digging cause I had seen the issue before with the &amp feeds out of IPB.

    I made the minor change in this section:

    // defaults and variable translation
    $url = str_replace ( "|xq|", "?", $url );
    $url = str_replace ( "|xe|", "=", $url );
    $url = str_replace ( "|xa|", "&", $url );
    $url = htmlentities($url);
    
    // Extra code to clean URL from possible non standard signs
    $url=html_entity_decode($url);
    //End extra code 
    
    
    


    Please note the last bit in the code (actual only 1 line), this is the change I made. I haven’t tested it with a NON &amp yet, cuz I am busy with building a site around IPB and can’t test it all out right now...

    Hope it helps out others and possible it get added, if proven right in the next update of this snippet.
      • 22303 MODX Staff
      • 10,725 Posts
      @Trance: thanks for the find. I think the htmlentities() call right before that should just be removed as well. There’s no need to encode more of the URL right before decoding it again, eh? Thoughts?

      @Duane: sorry for the troubles and my lack of bandwidth to research and resolve it, I’ve just been a little swamped this first quarter of 2006, and am trying to catch up! The old etomite snippet does work, but you can only use it once per page I believe? Or maybe not; I’d have to go back and look again to remember exactly why I created this version of it.
      tongue

      @ALL: NewsParserX version 0.9, with the fix from Trance has been uploaded in the first post.
        • 30546
        • 46 Posts
        Think you’re right. took me a while to figure out at first why it didn’t "work" Bu the first hyperlink that is been created is the actual link to the board. Was a little surprise to me at first. But heck, works like a charm, that is what I desired.. laugh thanks for the snippet..

          • 22815
          • 1,097 Posts
          I see from the code that other variables can be passed through:

          &descr=`1` - Shows description (ie content)
          &image=`1` - Shows image

          (In actual fact any value passed will make activate the description or image, not just 1.)

          However when I try to activate the description with my LJ feed, it displays content - but seriously gnarls up, repeating some parts.
          [[NewsParserX? &url=`http://paulgregory.livejournal.com/data/rss|xq|sa|xe|recent;type|xe|rss2;action|xe|.xml|xa|limit|xe|20` &descr=`1`]]


          Is anyone else using NewsParserX to successfully display the contents of a feed? (I’m not completely sure I want to, but I can see times when it would be useful.)
            No, I don't know what OpenGeek's saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: PaulGregory at May 30, 2006, 10:13 AM

            I see from the code that other variables can be passed through:

            &descr=`1` - Shows description (ie content)
            &image=`1` - Shows image

            (In actual fact any value passed will make activate the description or image, not just 1.)
            Correct, because all snippet parameters are treated as strings and any non-empty string or value other than `0` will evaluate to true, which is probably being used in the snippet code to test if the value evaluates to true using PHP’s loose typing strategies. Snippet authors would need to test the strings more thoroughly to handle values other than `0` or `` as false.

            Quote from: PaulGregory at May 30, 2006, 10:13 AM

            However when I try to activate the description with my LJ feed, it displays content - but seriously gnarls up, repeating some parts.
            [[NewsParserX? &url=`http://paulgregory.livejournal.com/data/rss|xq|sa|xe|recent;type|xe|rss2;action|xe|.xml|xa|limit|xe|20` &descr=`1`]]


            Is anyone else using NewsParserX to successfully display the contents of a feed? (I’m not completely sure I want to, but I can see times when it would be useful.)

            I think you may have the URL slightly incorrect...what you have above would be turned into this by the snippet:

            http://paulgregory.livejournal.com/data/rss?sa=recent;type=rss2;action=.xml&limit=20 -- shouldn’t the ; actually be |xa| in between recent;type and rss2;action?

            [NOTE: actually, looks like both URL’s work...does doing it the second way skew the results the same as the initial?]
              • 22815
              • 1,097 Posts
              Actually it’s doing ’if parameter equals "" set a variable to false’, so 0 will actually evaluate to true.

              I got the ; code from the usage instructions in the snippet, and it worked fine when I did a list of topic names.

              I now realise that in fact that I didn’t need any of that |xq|sa|xe|recent;type| business - I had mistakenly thought that the variables passed in the example RSS feed url were used by NewsParserX. They are not. Perhaps a future version could use
              http://feeds.feedburner.com/ModxBlogFeed as a shorter example URL that is less likely to cause such confusion? Or state that |xq| is to be used in place of ? etc in URLs.

              Anyway. The results are skewed no matter how I escape characters in the URL.
              The undocumented &descr bit seems to be getting clogged on HTML in feeds - ie..

              [[NewsParserX? &url=`http://feeds.feedburner.com/ModxBlogFeed` &descr=`1`]]
              

              screws up but something without HTML, like
              [[NewsParserX? &url=`http://rss.manchesteronline.co.uk/news.xml` &descr=`1`]]
              

              works fine.

              Now, that seems to be something in the original class itself causing the problem.
              Oh, and looking at the class code, there’s a nasty "or die" on line 426 which could be handled in a friendlier manner - I’m sure that we really don’t want the whole page to die just because an RSS file can’t be loaded!

              I may get round to fixing both issues myself, but before I do - is there any existing RSS feed display snippet that handles HTML content?
                No, I don't know what OpenGeek's saying half the time either.
                MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                Forum: Where to post threads about add-ons | Forum Rules
                Like MODx? donate (and/or share your resources)
                Like me? See my Amazon wishlist
                MODx "Most Promising CMS" - so appropriate!
                • 20207
                • 22 Posts
                Maybe an stupid question but is it possible to import RSS feeds directly in my database with NewsParserX? I have multiple news feeds and want to import an news article when it contains specific keywords.
                  • 36426
                  • 197 Posts
                  Hi can anyone please help me get this call to work:

                  [[NewsParserX? &url=`http://feeds.feedburner.com/york-news/`]]


                  I've tried losing the forward slash at the end. And I've tried the direct atom feed instead of the feedburner one which is:

                  http://www.insideyork.co.uk/talk/feed.php?f=7

                  Can't get either to work... Also tried RSS Import but this gives me errors. Can anyone please help?

                  Thanks.
                    Yorkshire UK based hosting provider: https://www.simulant.uk