We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24731 ☆ A M B ☆
    • 211 Posts
    Hi there, I am trying to use this for wunderground. I used the code:

    [!FeedX? &url=`http://www.wunderground.com/auto/rss_full/global/stations/78486.xml` &preset=`wunderground`!]

    but when I render the page, it gives me:

    « 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(): Unable to detect character encoding
    Error type/ Nr.: Warning - 2
    File: /home/***/public_html/cms/assets/snippets/FeedX/classes/feedx.class.inc.php
    Line: 104
    Line 104 source: return mb_convert_encoding($output, $modx->config[’modx_charset’], ’auto’);

    Parser timing
    MySQL: 0.0456 s (112 Requests)
    PHP: 0.4538 s
    Total: 0.4994 s

    Hope someone can direct me the right way.

    Thanks.
      • 24731 ☆ A M B ☆
      • 211 Posts
      I managed to get it working using weather.com instead and it is working good. I wonder if there is a way to also obtain the specs for the following days? The results only show for the current day.

      Thanks,

      jose R. Lopez
        • 24731 ☆ A M B ☆
        • 211 Posts
        I guess I was a bit lazy, just did a search on weather.com for their XML information and got a full PDF file with all the specs. Sorry about that.

        If anyone needs more info, the PDF really has a lot of info and is available free at their website. You do need to be registered.

        Regards,
        Jose R. Lopez
          • 1932
          • 137 Posts
          @redstormj:

          I’m not sure why encoding conversion was failing, possibly wunderground was sending some invalid ascii character. If you would rather use the wunderground feed, you should be able to get it working by changing the following:
          return mb_convert_encoding($output, $modx->config['modx_charset'], 'auto');
          to
          return $output;


          The PDF looks nice, you should also be able to add &debug=`1` to the snippet parameters which will provide you with a link to the debug console. The console will show you all of the data available within the feed and how to access each element when building your templates.
            • 19164
            • 1,215 Posts
            Great snippet, but we can’t to use function xml_parser_create (feedx.class.inc.php function parse($xml)) with encoding that not supported by xml_parser_create (for example windows-1251). The supported encodings are ISO-8859-1, UTF-8 and US-ASCII.

            So need to use mb_convert_encoding...
              DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

              Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

              [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
              • 24731 ☆ A M B ☆
              • 211 Posts
              Hi, I am trying to do something very simple, yet I seem to be doing something wrong or I am very confused I can’t get this to show up as I want.

              I am using it for weather.com and what I want as display is:

              Weather forecast for the next three days beginning today:

              Monday
              -> hi
              -> low
              -> Graphic

              Tuesday
              -> hi
              -> low
              -> Graphic

              Wednesday
              -> hi
              -> low
              -> Graphic

              I am getting all the values from the XML, they are stored there, but only one Image shows Up. When I include to get the Hi and Low values I get them listed for all three days, but I can’t find a way to format it as above as they are all called from one file include. Here is what I am using:

              Outer:
              {{WEATHER->inner}}


              Inner:
              {{DAYF->dayf}}
              {{CC->cc}}


              Dayf
              <div class="weather_day">[+DAY.T+]</div>
              {{DAY->day}}
              <div class="weather_day">[+DAY.1.T+]</div>
              <div class="weather_day">[+DAY.2.T+]</div>


              Day
              <span class="wheather_hi">Hi</span> [+HI+]
              <span class="wheather_lo">Lo</span> [+LOW+]


              cc
              <img src="http://image.weather.com/web/common/wxicons/52/[+ICON+].gif" />
              


              Any assistance is greatly appreciated.

              The attached graphic may give you a clue of how I want this to look.
                • 4971
                • 964 Posts
                José:

                You need three icons, the one you are using is for the current weather conditions (cc = current conditions).

                You need to extract the information you want from the dayf section of the feed. So you would have three chunks of code:
                1) cc with the conditions and the icon
                2) You have a <dayf> section with the forecast, two <day> sections, one for tomorrow and one for the day after tomorrow and two <part> sections for each day, one for the day forecast and one for the night forecast.
                Inside <part> you have the icon for the forecast, inside <day> you have the high and low information and inside <dayf> you have the days you want.

                Let me know if this points you in the right direction... the weather.com guide is very helpful to decifer all the info as well as the debugger from feedx...
                  Website: www.mercologia.com
                  MODX Revo Tutorials:  www.modxperience.com

                  MODX Professional Partner
                  • 24731 ☆ A M B ☆
                  • 211 Posts
                  Hi charliez,

                  thanks for your help, that’s the same logic I am trying to apply, been trying to get this to work for the past 4 hours, but I can’t seem to limit the requests to get specific info as the logic dictate.

                  How can I instruct the template to only give me one hi and one low from a specific day?

                  Whenever I try to load these values I get the results for all days in a recurring manner. I’ve been playing with the debug over and over and trying different variables from those available without success.
                    • 24731 ☆ A M B ☆
                    • 211 Posts
                    I think I have it figured out, but I am unable to limit the data extraction per day, it always trys to recursivly extract data for the forecast and not specifically for one day. here is what I have:

                    Outer:
                    {{WEATHER->inner}}


                    Inner:
                    {{DAYF->dayf}}


                    DayF:
                    <div class="weather_day">[+DAY.T+]
                    {{DAY->day}}
                    </div>


                    Day:
                    {{PART->part}}
                    <span class="wheather_hi">Hi</span> [+HI+]
                    <span class="wheather_lo">Lo</span> [+LOW+]


                    Part:
                    <img src="http://image.weather.com/web/common/wxicons/52/[+ICON+].gif" />
                    


                    This is the output I am getting:

                    <div class="weather_day">Monday
                    
                    <img src="http://image.weather.com/web/common/wxicons/52/44.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/47.gif" />
                    
                    <span class="wheather_hi">Hi</span> N/A
                    <span class="wheather_lo">Lo</span> 74<img src="http://image.weather.com/web/common/wxicons/52/38.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/38.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/47.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/47.gif" />
                    
                    <span class="wheather_hi">Hi</span> 89
                    
                    <span class="wheather_lo">Lo</span> 74<img src="http://image.weather.com/web/common/wxicons/52/38.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/38.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/38.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/47.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/47.gif" />
                    <img src="http://image.weather.com/web/common/wxicons/52/47.gif" />
                    
                    <span class="wheather_hi">Hi</span> 90
                    <span class="wheather_lo">Lo</span> 75
                    </div>
                    


                    So, My problems are:

                    1.- How do I code it to get the data for a specific day so it doesn’t recursively output the following tags.
                    2.- Why are there so many images in the output? I though I would only get day and night, but I seem to get much more than that.
                    3.- How can I just chose one Image? Ideally, should be in order, so that if it is less than 2 P.M. (which is the limit time for the day image) it will pull the day image, if it is over 2 P.M. it will pull the night image.

                    I appreciate your help.

                    Regards,
                    Jose R. Lopez
                      • 4971
                      • 964 Posts
                      Mmmm... weird...

                      1) Can you post your FeedX call ?
                      2) are you using the debugger?

                      Reading the weather.com guide, you have to indicate the day and the part of day.
                      As you can read, the day has an argument d="1" or d="0", and part has also an
                      attribute p="n" or p="d"... seems like it is calling everything as it does not know
                      which one to send...

                      You also have to tell FeedX and weather.com to have &dayf=2 so the forecast
                      only includes 2 days... (I think you are already doing this)

                      THE problem is that I do not know how to access the attributes! The best way will
                      be to check the debugger to see 1) what and in what order is the feed sending the
                      forecast info and 2) see the tpl builder to see if it is giving you a way to access the
                      attributes...

                      let me know...
                        Website: www.mercologia.com
                        MODX Revo Tutorials:  www.modxperience.com

                        MODX Professional Partner