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

    I really can not find a lot of docs on FeedX and need to know how to do some stuff. I do this with magie rss:

    <?
    $num_items = "1"; /* number of items to display */

    $url = "http://myurl.com/mainrss.php?area=11";
    $rss = fetch_rss( $url );
    $items = array_slice($rss->items, 0, $num_items);
    foreach ($items as $item) {
    $href = $item[’link’];
    $title = $item[’title’];
    $description = $item[’description’];
    }
    /* End of Events Feed */
    ?>

    <h2><a href="<?php echo $href; ?>"><?php echo $title; ?></a></h2>
    <div class="description"><?php echo $description; ?></div>
    <div class="bedate">For More Information On <?php echo $title; ?> |
    <a href="<?php echo $href; ?>">Click Here</a> </div>

    Can someone explain how I do this in FeedX been trying for way to long and I need help. Thanks!
      • 14050
      • 788 Posts
      Make your call like this:

      [!FeedX? &debug=`1` &url=`http://myurl.com/mainrss.php|xq|area|xe|11`!]

      Then look at the template builder or post a link to the page running the debug console and we will be able to help.
        Jesse R.
        Consider trying something new and extraordinary.
        Illinois Wine

        Have you considered donating to MODx lately?
        Donate now. Every contribution helps.
        • 8254
        • 15 Posts
        Hey Jesse, Thanks for the help:) Everything seems to be ok but just need to pick the correct element, in this case it would be description. What it is pulling now is just the title of the rss file. Is there an easy way just to grab the description?
          • 14050
          • 788 Posts
          Yes, FeedX makes it easy to grab any element in the feed. Just look under the template builder tab in the debug console for the placeholder you should use to get at the description. Without seeing the feed or the debug console, I won’t be able to tell you much more than that.
            Jesse R.
            Consider trying something new and extraordinary.
            Illinois Wine

            Have you considered donating to MODx lately?
            Donate now. Every contribution helps.
            • 23491 ☆ A M B ☆
            • 1,056 Posts
            It seems that the &maxElements parameter does not apply when used in conjunction with the &preset parameter. It makes sense given the structure of FeedX’s template system, however I still wonder if there is a way to limit feed elements when using presets...
              Mike Reid - www.pixelchutes.com
              MODx Ambassador / Contributor
              [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
              ________________________________
              Where every pixel matters.
              • 14050
              • 788 Posts
              Don’t forget that you can use this syntax inside your preset to limit elements of a feed:

              {{ITEM(limit,offset)->tplName}}
                Jesse R.
                Consider trying something new and extraordinary.
                Illinois Wine

                Have you considered donating to MODx lately?
                Donate now. Every contribution helps.
                • 24731 ☆ A M B ☆
                • 211 Posts
                Would this work if the RSS is behind an https request? I am having problems trying to parse a URL, like:

                https://username:[email protected]:2087/xml-api/listaccts

                This is an XML API call to WHM: http://www.cpanel.net/plugins/xmlapi/

                I am trying to interface with it for my Web Hosting Site.

                The call works well when I do it on the browser, but FeedX does not seem to like it. The debug window reports:

                https://username:[email protected]:2087/xml-api/listaccts [ERROR RETRIEVING FEED]

                One thing I noticed on the browser when accessing the feed is the lack of formatting and the file source goes straight into the content. Here is a sample of the feed source code:

                <listaccts>
                  <acct>
                    <disklimit>unlimited</disklimit>
                    <diskused>24M</diskused>
                    <domain>somedomain.com</domain>
                    <email>[email protected]</email>
                    <ip>00.11.22.333</ip>
                
                    <owner>username</owner>
                    <partition>home</partition>
                    <plan>Some Plan Name</plan>
                    <startdate>06%20May%2003%2016:11</startdate>
                    <theme>x2</theme>
                    <unix_startdate>1146687060</unix_startdate>
                
                    <user>acctusername</user>
                  </acct>
                </listaccts>


                Of course I changed some of the values for dummy for the sake of sample.

                Any help is greatly appreciated.
                  • 24731 ☆ A M B ☆
                  • 211 Posts
                  After doing some reading and checking up the class for the snippet I figured it out. In the curl function it needed an option to override the security prompt, so I simply added:

                  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);


                  Now it returns data as I was expecting. So what I will do is add a new optional parameter to the snippet call so I can default that option to true as it is set default but I can switch it through the snippet call when it is needed.

                  Once I have the code updated I will post it here if anyone needs it.

                  Jose R. Lopez
                    • 24731 ☆ A M B ☆
                    • 211 Posts
                    Here is the code:

                    In the snippet code, find above the debug param and add the following:

                    $params['skipssl'] = isset($skipssl) ? intval($debug) : 0;
                        // Set to 1 to skip ssl verify


                    Then in: feedx.class.inc.php file, around line: 279 you will find

                    			$curl = curl_init();
                    			curl_setopt($curl, CURLOPT_URL, $this->config['url']);
                    


                    Just bellow it and before:

                    			curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                    


                    simply add this:

                    			if ($this->config['skipssl']) {
                    				curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
                    				curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                    			}
                    


                    Then your snippet call just needs &skipssl=`1`
                      • 12110
                      • 122 Posts
                      Hello,

                      this is a great tool, but unfortunately after this feed had been fetched and displayed before without problems ...

                      [!FeedX? &url=`http://www.top50-solar.de/rss/rss_0_1.xml` &preset=`rss` &cacheTime=`3600` &debug=`0`!]


                      ... I got this modx error message today :

                      I« MODx Parse Error »
                      MODx encountered the following error while attempting to parse the requested resource:
                      « PHP Parse Error »
                       
                      PHP error debug
                        Error: mb_convert_encoding() [function.mb-convert-encoding]: Unable to detect character encoding  
                        Error type/ Nr.: Warning - 2  
                        File: /kunden/102604_85625/webseiten/solar-ag/assets/snippets/FeedX/classes/feedx.class.inc.php  
                        Line: 104  
                        Line 104 source: return mb_convert_encoding($output, $modx->config['modx_charset'], 'auto'); 


                      It seems to be a charset problem or a formatting error of one of the feed items, or not? The charset of modx is set to utf-8.

                      There were also problems with other feeds - i.E. no items were fetched at all with this:
                      [!FeedX? &url=`http://www.solarportal24.de/rss10.xml` &preset=`rss` &cacheTime=`3600` &debug=`1`!]

                      In the debug console the feed items were readable, but the snippet didn’t render anything.

                      Do I have to change character settings (I’m in Europe) or is there any other hint? huh

                      Thanks a lot in advance if you can help!