We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6094
    • 60 Posts
    I’m having an incredibly difficult time getting this to work. I downloaded the zip file from Stanback.net. However, once it is extracted there is only one file and I’m not sure it is what I actually need. It is titled FeedX-0.1.2 but there is no file extension.

    I copied the FeedX-0.1.2 directory to the assets/snippets directory on my server as mentioned in the setup instructions.

    Then, there is the following mention.

    "Next, create a new snippet from within the MODx manager and copy and paste the contents of "feedx.snippet.php" which is located in the archive."

    However, I do not have a feedx.snippet.php file in the extracted archive. Any thoughts would be greatly appreciated.
      • 32699 ☆ A M B ☆
      • 427 Posts
      you need to create the snippet within modx and post the content there.

        Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

        Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
        • 4041
        • 788 Posts
        I just downloaded the .zip file, you have to unzip the file you download, then also run your unzip program on the file you get after unzipping. I’m sure that’s why you only see one file. Once unpacked it will make more sense smiley
          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 22770
          • 285 Posts
          Also, make sure you’re using this link to download the zip file: http://www.stanback.net/code/modx/feedx.html?d=FeedX-0.1.2.zip

          I’ve tested that, and once you’ve unzipped the file, everything you need is in there.
            • 32699 ☆ A M B ☆
            • 427 Posts
            Now if we can get the author to produce a revolution version.
              Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

              Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
              • 28654
              • 1 Posts
              Ripper snippet!

              I’ve been using this to retrieve and display some Xbox Live data. It’s going alright.

              Just showing some appreciation.
                • 4041
                • 788 Posts
                Perhaps change the single quotes to backticks in the &url param ( &url=`linkhere` ).
                  xforum
                  http://frsbuilders.net (under construction) forum for evolution
                  • 32699 ☆ A M B ☆
                  • 427 Posts
                  Quote from: wshawn at Nov 18, 2009, 11:13 AM

                  Now if we can get the author to produce a revolution version.

                  I have e-mailed him and he said he would be working on this for Revolution
                    Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                    Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
                    • 18435
                    • 1 Posts
                    Hi everybody,

                    I am completely new to MODx and FeedX and I ran into a problem which seems to be a bug in FeedX. Maybe I am wrong and you are able to set me straight smiley

                    I wanted to include an iso-8859-1 encoded feed into a MODx-page, which is utf-8 encoded. Doing that the feed lost the german umlauts. Here is the data I am working with:
                    Feed-URL:
                    http://www.photomed.de/index.php?id=240&type=100

                    Snippet-call:
                    [!FeedX? &url=`http://www.photomed.de/index.php|xq|id|xe|240|xa|type|xe|100` &preset=`rss` &cacheTime=`3600` &debug=`0`!]

                    I am using an MODx 1.0.2 with FeedX 0.1.2 on utf-8

                    After looking into the FeedX code I found that in line 104 in the feedx.class:
                    return mb_convert_encoding($output, $modx->config['modx_charset'], 'auto');

                    The input-encoding is set to ’auto’ which expands to ’ASCII,JIS,UTF-8,EUC-JP,SJIS’ according to the php-doc. As iso-8859-1 is not part of that collection I tried to introduce a feedx-class property called ’inputEncoding’ which stored the encoding of the feed (read from the original feed around line 336). That was just before I discovered that FeedX caches the parsed xml-tree and _not_ the feed-xml itself. So the encoding wouldn’t have been available if cached data would have been used. I decided that the parsed xml-data itself was the problem. When the above code gets executed the code does not now what it’s input is encoded with, nor does any other code know.

                    Some php documentation later I found:
                    xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'myencoding');

                    So far FeedX only defined the input-encoding for the xml-parser. The output-encoding defaults to the input-encoding (iso-8859-1 in my case) which gets converted with mb_convert_encoding later on (without success). Now it is possible to convert the xml-parser result to something more convenient. Unfortunately only these encodings are supported by the xml-parser as output-encoding:
                    ISO-8859-1, US-ASCII and UTF-8
                    We are aiming for a support of all encodings that are supported by MODx, so that wouldn’t work. My current solution is to translate the parsed xml to utf-8. That should work in any case as any MODx-supported char-encoding fits into utf-8 (as far as I know). The later call to mb_convert_encoding now knows that its input is utf-8 under any circumstances (cached / non-cached). The call to mb_convert_encoding is only made if the output-encoding is anything but utf-8.

                    Disadvantages:
                    - Feed encoded in a and output encoding is b (a and b not beeing utf-8) will always be converted over utf-8 which might result in an useless encoding-run

                    Advanatages:
                    - Should work with any MODx-supported encodings now (hopefully)

                    It is my first code-contribution and I don’t know what format fits best. I tried to create a patch for my changes. Source-version was feedx-0.1.2.

                    Index: feedx.class.inc.php
                    ===================================================================
                    --- feedx.class.inc.php	(working copy)
                    +++ feedx.class.inc.php	(revision 4)
                    @@ -100,8 +100,9 @@
                     			}
                     		}
                     
                    -		if (function_exists('mb_convert_encoding'))  // Convert output encoding, if available
                    -			return mb_convert_encoding($output, $modx->config['modx_charset'], 'auto');
                    +		// Only convert encoding if output-encoding differs from utf-8 and encoding-function is available
                    +		if ($modx->config['modx_charset'] != 'UTF-8' && function_exists('mb_convert_encoding'))
                    +			return mb_convert_encoding($output, $modx->config['modx_charset'], 'UTF-8');
                     		else
                     			return $output;
                     	}
                    @@ -336,6 +337,8 @@
                     
                     		$parser = xml_parser_create($encType);
                     		xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1);
                    +		// Always decode to UTF-8 as the parser does not support enough charset-encodings to fit all supported MODx-encodings
                    +		xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
                     		xml_set_object($parser, $this);
                     		xml_set_element_handler($parser, 'tagStart', 'tagEnd');
                     		xml_set_character_data_handler($parser, 'tagData');
                    
                    


                    Quite easy changes. Took me 4 hours anyway. I’m eager to hear your feedback!


                    So long
                    Marc
                      • 31074
                      • 14 Posts
                      1st: Great, great snippet!
                      But ofcourse I have 2 questions:

                      1) My call & templates work just fine, however I want to limit the number of characters displayed in the [+ATOM|SUMMARY+]. Can anybody tell me how & where to do this? I’m pretty sure I’ve stumpled upon the answer already (when I didn’t need it), but can’t seem to find it again... :-(

                      2) How do I use the "oddElements"? What syntax do I use & where do I put this, in my call or in my tpl? I know there’s an explanation in the snippet, but I don’t quite get it....

                      regards,
                      koen