We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31074
    • 14 Posts
    Ok, I figured out the 2nd question about ’oddElements’:
    in my call I placed
    &oddElements=`ITEM->item2`

    in wich item2 is my template for oddelements; works like a charm!

    Solved the 1st question the quick & dirty way: in my css i gave the ’li’ a specific height and ’overflow: hidden’.
    This works, but not completely like I want it to. A ’read more >>’ at the end of the line would be better, so if anyone has a proper way of solving this, plz let me know!

      • 20728
      • 53 Posts
      I don’t know if anyone can help with this but we have an issue with FeedX, we’re using FeedX to pull in an RSS feed from Twitter.

      The Twitter feed has just had a new Tweet added that has broken FeedX. The new Tweet included a pound sign (£).

      The page the feed was embedded into generated an error as follows:

      mb_convert_encoding() [function.mb-convert-encoding]: Unable to detect character encoding

      I have implemented the code kindly supplied by marsbear which does seem to have helped, the page now displays but the pound sign is shown as a black diamond with a question mark in Firefox (i.e. the normal behaviour when it can’t interpret a character).

      Any suggestions gratefully received!
        Enovate Design | Web Design Agency Essex
        • 31961
        • 23 Posts
        Not sure where to post help regarding FeedX, as nobody seems to be replying back to help requests here. I have posted a topic in the Module, Plugin & Snippet Usage forum:
        http://modxcms.com/forums/index.php/topic,45137.0.html

        I’m hoping somebody will be able to point me in the right direction or show me the obvious!

        Thanks

        Warmbeat
          • 7455
          • 2,204 Posts
          Would it be posible to create document from a feed? for each new item a new document.

          I like to create an arhive for a feed we read and this would be the best way, another great thing is that this way we can use ditto to create a nice summery etc.
          also thos documents can then again be used in other places more easy.

          the best thing is that the older documents in the feed wil be preserved.

          Dimmy
            follow me on twitter: @dimmy01
            • 32699 ☆ A M B ☆
            • 427 Posts
            Dimmy -- have you thought of having another snippet calling FeedX and then pull its output and create a chunk -- presumably named by date

            -- Instant archive.

            I’m sorry I don’t get around the Evo forums much. I spend the majority of my time working on Revo...


              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
              • 7455
              • 2,204 Posts
              I created a snippet that puts data from a feed into the database,
              Its a Raw snippet and it does wat I want it to do, still needs some checks like adding the right domain in front of relative path links and images inside description and make special characters apear ok in modx now lots of charackters are encoded wrong somehow
              here it is use it at your own risk:

              <?php
              $parent = 39; //parent to put the new pages under
              $rssfeed = 'http://www.kvk.nl/rss/nieuws?pub_id=14'; //put your rss feed here
              $doc = new DOMDocument();
              	$doc->load($rrsfeed); 
              	$arrFeeds = array();
              	foreach ($doc->getElementsByTagName('item') as $node) {
              		$itemRSS = array ( 
              			'pagetitle' => addslashes($node->getElementsByTagName('title')->item(0)->nodeValue),
              			'longtitle' => addslashes($node->getElementsByTagName('title')->item(0)->nodeValue),
              
                                      //lots of adding slashes and stripping some info to create a intro text and a seperate content from one description
              			'content' => str_replace(addslashes(getTextBetweenTags($node->getElementsByTagName('description')->item(0)->nodeValue,'strong')),'',addslashes($node->getElementsByTagName('description')->item(0)->nodeValue))."<br /> <em class=\"bron\">Bron: <a href=\"".addslashes($node->getElementsByTagName('link')->item(0)->nodeValue)."\" title=\"".addslashes($node->getElementsByTagName('title')->item(0)->nodeValue)." \">Kamer van Koophandel</a></em>",
              			'introtext' => addslashes(getTextBetweenTags($node->getElementsByTagName('description')->item(0)->nodeValue,'strong')),
              			'description' => addslashes($node->getElementsByTagName('title')->item(0)->nodeValue),
              			'createdon' => strtotime($node->getElementsByTagName('pubDate')->item(0)->nodeValue),
                                      'parent' => $parent,
                                      'published' => 1,
                                      'hidemenu' => 1,
                                      'template' => 3 // template that you like to use
              			);
                            // check if item is already in database
                           if (dimCheckDate($itemRSS['createdon']) == 0){
                               // insert item into database
                              insert_Item($itemRSS);
                            }
              
              	}
              
              // an atempt to clear the cache I think that it does not realy works I need to clear cache by hand to see the pages online
              $modx->clearCache();
              return;
              
              
              //function to put the data into the database
              function insert_Item($itemArray) {
              	global $modx;
              	$table_name = $modx->getFullTableName ( 'site_content' );
              	$modx->db->insert ( $itemArray, $table_name );
              }
              
              //check date, so that no double entry's are made in the database
              function dimCheckDate($pubDate) {
              	global $modx;
              	$res = $modx->db->select ( "createdon", $modx->getFullTableName ( 'site_content' ), "createdon='" . $pubDate . "'" );
              	if(count($modx->db->makeArray ( $res )) > 0){return 1;}
                      else{
              	return 0;
                      }
              }
              
              // function to get text inside tags to create a introtext  or somthing from the first part (in my case it wass in <strong> tags
               function getTextBetweenTags($string, $tagname)
               {
                  $pattern = "/<$tagname>(.*?)<\/$tagname>/";
                  preg_match($pattern, $string, $matches);
                  return $matches[1];
               }
              ?>
              


              Greets Dimmy
                follow me on twitter: @dimmy01
                • 4310
                • 2,310 Posts
                Nice work Dimmy smiley
                Congrats on making 2000 posts.
                  • 22435
                  • 16 Posts
                  Hey, Dimmy, where do you call this snippet? In the parent doc with a Ditto call, for example?

                  Thanks for any feedback!

                  Best,
                  Andrew
                    • 7455
                    • 2,204 Posts
                    Quote from: Oudein at Mar 24, 2010, 07:46 AM

                    Hey, Dimmy, where do you call this snippet? In the parent doc with a Ditto call, for example?

                    Thanks for any feedback!

                    Best,
                    Andrew

                    Just call it anywhere you like if you like it to be updated a lot put it on the homepage if not that just put it on the page you like to summerize the inported documents.

                      follow me on twitter: @dimmy01
                      • 30777
                      • 1 Posts
                      There seems to be a problem with the way FeedX handles the Scandinavian letters Æ, Ø and Å

                      &aelig; æ
                      &oslash; ø
                      &aring; å

                      The twitter feed on my site www.tuejepsen.dk deletes spaces between words starting or ending with the letters. Perhaps it is a Twitter issue as well, I am not sure. MODx itself usually handles the letters perfectly.

                      Otherwise, great snippet.