We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14050
    • 788 Posts
    Squashed the bug with the javascript errors. For some reason the weekends had an extra "\n" character that I needed to remove and it solved the problems. Demo after the break:

    http://www.cmssandbox.com/MODx095/index.php?id=89
      Jesse R.
      Consider trying something new and extraordinary.
      Illinois Wine

      Have you considered donating to MODx lately?
      Donate now. Every contribution helps.
      • 14050
      • 788 Posts
      Alright. Here is a version styled a little nicer, utilizes the same calendar class that was original included, but with ajax navigation. This calendar class will also allow for multiple events in the calendar view. What does this all mean? Nothing much, you should be able to drop this right in with minimal changes and enjoy the ajax benefits. What would be the best way to check if javascript is available so that I can degrade back in PHP from ajax to the regular GET method that it was using?

      http://www.cmssandbox.com/MODx095/index.php?id=90
        Jesse R.
        Consider trying something new and extraordinary.
        Illinois Wine

        Have you considered donating to MODx lately?
        Donate now. Every contribution helps.
        • 15734
        • 70 Posts
        Hi,

        I’ve installed this snippet as per the instructions. Made sure there was only one set of <?php ?>. Changed the gmail address in the snippet and in the snippet call. this is my call:

        [!GoogleEvents?dayNameSize=`full`&outputType=`calendar`&calendarType=`wide`&email=`[email protected]`!]

        My page returns nothing. No calendar, no errors and not even any code (page source) referring to the snippet call. Any ideas what I’m doing wrong?

        I’m using Modx 9.6.1 and Google Events 1.4.1
          • 14050
          • 788 Posts
          I tried accessing your feed and I was unable to.  Is your calendar public?  Do you have an events currently scheduled?  If you have no events, Google will not publish a feed, even if it is public.  However, you should at least get some message to that effect.  Please make sure it is public with some events and then try it again.  If you are stilling have trouble, please do try this call:

          [!GoogleEvents? &debug=`1`!]

          Paste that information here along with the version of MODx and PHP you are using.
            Jesse R.
            Consider trying something new and extraordinary.
            Illinois Wine

            Have you considered donating to MODx lately?
            Donate now. Every contribution helps.
            • 18830
            • 161 Posts
            Jesse R. just give me the advice http://modxcms.com/forums/index.php/topic,12657.msg126632.html#msg126632 to use GoogleEvents instead of FeedX for more then one calendar. And this was a good advice. smiley

            Now I´m trying to format the date and time outputs. Sure, there are parameters. But I´m using the vcard microformat for my calendars. Thats why I need the time and date outputs in two versions - machine and human readable.

            So I tried the PHx date modifier:

             [*phx:input=`[+startTime+]`:date=`%H:%M`*]
            


            The output will be always 01:00, startTime may be 03:23pm or 5:14 am. And the year of startDate or endDate will be of course always 1970.

            This happens because time and date will be prefomated with the GoogleEvents(date())-English.php at line 41 or so:

            // Format for date and time
            $dateFormat = isset($dateFormat)? $dateFormat : "%D"; // mm/dd/yy see http://us2.php.net/strftime for details.
            $timeFormat = isset($timeFormat)? $timeFormat : "%T";
            


            and at line 148:

            $startDate = strftime($dateFormat,$sortDate);
            $startTime = strftime($timeFormat, $sortDate);
            



            What can I do to get the unformatted UNIX timestamp?
              • 18830
              • 161 Posts
              Okay, I got it wink

              I changed

              //$startDate = strftime($dateFormat,$sortDate);
              //$startTime = strftime($timeFormat, $sortDate);
              


              to

              $startDate = getGoogleDate($startDate);
              $startTime = getGoogleDate($startDate);
              


              and

              //$endDate = strftime($dateFormat,$tempEndDate);
              //$endTime = strftime($timeFormat, $tempEndDate);
              


              to

              $endDate = getGoogleDate($endDate);
              $endTime = getGoogleDate($endDate);
              


              Of course the date and time parameters won´t work anymore. Instead of it I can use PHx date modifiers to get the output I need.
                • 14050
                • 788 Posts
                Glad you got it working. If you run into any other problems...just let me know. Another solution would be to do the following:

                Around line one 181, change the array events array to:

                $events[]=array('time'=>$sortDate,'where'=>$where,'title'=>$item->get_title(),'url'=>$url,'eventDescription'=>$eventDescription,'startDate'=>$startDate,'startTime'=>$startTime,'endDate'=>$endDate,'endTime'=>$endTime,'startYear'=>$startYear,'startDay'=>$startDay,'startMonthCal'=>$startMonth,,'endTime'=>$tempEndDate);
                


                Then around line 219 add in a couple more strings to replace:
                $output = str_replace('[+sTimestamp+]',$event['time'],$output);
                $output = str_replace('[+eTimestamp+]',$event['endTime'],$output);
                


                Now you can utilize [+sTimestamp+] and [+eTimestamp+] to pass to PHx. This is the direction I will likely go with and using it would ensure an easier upgrade path for you.

                I haven’t tested this, so if it doesn’t work, revert back to your method.
                  Jesse R.
                  Consider trying something new and extraordinary.
                  Illinois Wine

                  Have you considered donating to MODx lately?
                  Donate now. Every contribution helps.
                  • 727
                  • 502 Posts
                  I’m using the latest version and I can’t get it working. I’m sure I am doing something stupid.

                  I can see the XML feed just fine if I click on the XML button in Google Calendar.
                  If I turn debug mode on in the snippet I can click on the XML feed link and view it just fine.

                  But still the snippet returns "The feed is unavailable...". When this message is printed $calendar_xml_address is empty. Here is my snippet call (email address changed):

                  [!GoogleEvents? &dayNameSize=`full` &outputType=`calendar` &calendarType=`wide` &email=`[email protected]`!]


                  Incidentally I cut and paste the snippet call from the readme file and it didn’t execute with my email address. Instead it was using the default gmail address. I had to add spaces before the amperstands to get it to see my email address.

                  Any ideas? Andy
                    • 727
                    • 502 Posts
                    I downgraded to 1.3.4 and it gives the same error. However this time there is a link at the end of the error message. When I click on it it shows me the XML file...

                    Andy
                      • 18830
                      • 161 Posts
                      eTimestamp and sTimestamp work like clockwork. Thank you, Jesse R. It would be great to include both of them in the next version of GoogleEvent because it will become more versatile.

                      If somebody is interested in using Microformats and GoogleEvents with sTimestamp and eTimestamp - here is an example.

                      <dl class="vevent">
                      <dt class="summary">[+title+]</dt>
                      <dd><abbr class="dtstart" title="[*phx:input=`[+sTimestamp+]`:date=`%Y%m%dT%H%M+0100`*]">[*phx:input=`[+sTimestamp+] `:date=`%H:%M`*] Uhr</dd>
                      <dd>[*phx:input=`[+sTimestamp+]`:date=`%A, %d.%m`*]</dd>
                      <dd class="description">[+content+]</dd>
                      <dd class="location">[+where+]</dd>
                      </dl>