We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38755
    • 43 Posts
    Ooh, this looks very promising... I’m excited by the different efforts in events/calendars that are coming up lately.

    This looks to be the best fit for a site I’m working on right now, leveraging Google Calendar’s capabilities (recurring events in particular). Thanks ChuckTrukk!

    Quote from: Soshite at Apr 17, 2009, 08:10 PM

    I got some weird fatal error if I added it, IIRC, so I dunno if maybe something’s wrong in the code...
    Soshite I was getting the same problem you mention above (I’d spotted the missing semi-colon), my error was simplepie complaining about not being able to write to the cache folder. I just created a cache folder (assets/snippets/calendar/cache) that was writable as needed and all appears well.
      • 28033
      • 925 Posts
      That got it to work.

      Although I noticed the templates will cause XHTML errors, since it inserts the css outside of the <head> tags.

      EDIT: Is there a way to let this show events at least a year in advance? I’m trying to use this for future events for the Tales of series, and there’s a convention in June, but the calendar isn’t showing it.
        My Snippets
        -> PopUpChunk v1.0
        • 38755
        • 43 Posts
        I was just going to post a request to be able to show all upcoming events on a single page for list mode, as I can imagine several cases where I would want to show more than a month for that display type.

        For the project I’m working on I want to display all events through the end of the year, preferably grouped into their months and then use a jQuery function to setup on the fly column sorting and filtering. I may take a stab at editing this to output the events for the year and template them into a table instead of a list so the sorting/filtering I have in mind is doable. Not quite sure how best to return the events within month groupings (for my purposes I want to have a <th> row with the month preceding all the events for that month), maybe call a new SimplePie instance for each month and just increment an offset. That seems like a really heavy way to go about it tho.

        Chuck, is any of this any interest to you for this snippet? I’d think the ideal would be to be able to pass parameters for the window of time to show, perhaps as a start date and end date. Or, to keep it simple it could just be a number of days and left as an exercise to the developer if they want to use something like a nested snippet to automatically pass the number of days remaining until X date.
          • 34017
          • 898 Posts
          First,

          Susan- It’s great to see you on here again. Missed you.

          Soshite- was the problem that the cache folder needed write permissions?

          proto- That does seem quite interesting. There are a few ways yo could do it.

          1. Output everything into one long list. Then use js to make seperate calendars from each month in the list.

          2. loop through each month from the simplepie feed, and create a new template for each one.

          3. Maybe we could call the calendar snippet multiple times.

          I think #2 would be best. If anyone wants to think through what parameters are needed etc. I recommend you fork it in github. Im really busy the next 2 weeks so probably wont have much time to do this.

          I think multiple calendars one one page are a great idea. I would create a parameter for how many calendars to show. Loop through the events as
          <?php
          
          
          $cal_dates = array();
          for ($i = 0; $i < sizeof($gcalendar_data) ; $i++){
          
             $startDate = $item->get_start_time();
             $endDate   = $item->get_end_time();
             $calName   = $item->get_name();
             $month = date('n', $startDate - $offset);
             $cal_dates[$month][] = array(
                //the array stuff here
             );
          
          $i++;
          }
          $output = '';
          foreach ($cal_dates as $month) {
               $cal = new Calendar_Events ($year, $month);
               //cal output stuff here
               $output .= $cal;
          
          }
          
          echo $output;
          ?>
          


          That’s rough, but that’s how I would do it i think. Simplepie already gets the max amount of feeds for all months. And it’s cached.
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 38755
            • 43 Posts
            Awesome, thanks Chuck... makes much more sense, I couldn’t conceptualize this at the time. Number 2 does sound like the best approach, and your sample there is perfect for me to bootstrap from. This is still probably a bit too much for me to complete, but I’ll see if I can get a colleague to help. If I get it working successfully I’ll certainly add it as a fork in github.

            FYI, related to Soshite’s issue and the fix being the cache folder for me -- the cache folder didn’t exist to begin with. The error just made sense to me, and I’ve used SP before so knew one was necessary (well, not strictly so but for most practical applications).
              • 34017
              • 898 Posts
              Yeah, im still learning github. I’ll add the cache folder so it’s there this week. It should be.
                Chuck the Trukk
                ProWebscape.com :: Nashville-WebDesign.com
                - - - - - - - -
                What are TV's? Here's some info below.
                http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
                • 11055 ☆ A M B ☆
                • 3,112 Posts
                Wow...
                This snippet is very promising.

                Anyway,
                I just played around with this, and found something weird:

                Why do you place <link rel=...> inside the tpl? My testing showed the the tpl didn’t pull out the css and js file. I had to copy those lines to the ModX’s template <head> section to make this work.

                I’ve tried previously to change in the beginning lines of calendar.tpl, but it also didn’t work, from:
                <link href="calendar/templates/ical/calendar.css" media="screen" rel="stylesheet" type="text/css" />
                <script type="text/javascript" src="calendar/templates/ical/jquery.coda.js"></script>
                

                to:
                <link href="<?php echo $modx->config['base_path'];?>templates/ical/calendar.css" media="screen" rel="stylesheet" type="text/css" />
                <script type="text/javascript" src="<?php echo $modx->config['base_path'];?>templates/ical/jquery.coda.js"></script>
                

                In the install instruction, don’t you think that
                $basePath = $modx->config['base_path'] . '/assets/snippets/calendar/';
                include $basePath . 'calendar.inc.php'

                supposed to be like this?
                $basePath = $modx->config['base_path'] . 'assets/snippets/calendar/';
                include $basePath . 'calendar.inc.php';


                Thx ahead.
                  Rico
                  Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                  MODx is great, but knowing how to use it well makes it perfect!

                  www.virtudraft.com

                  Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                  Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                  Maintainter/contributor of Babel

                  Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                  • 34017
                  • 898 Posts
                  goldsky,

                  The CSS and JS are inside the tpl file as an example. It still works in the demos though. And Breezer and I mentioned creating a LoadScripts snippet that could load multiple css and js files into the <head> from a snippet. Stand by for that.

                  I might need to update the $basePath to what you have. I’m going to install on a fresh modx site this week and see if anything needs to be fixed. Then release it into the modx repo.

                  Chuck
                    Chuck the Trukk
                    ProWebscape.com :: Nashville-WebDesign.com
                    - - - - - - - -
                    What are TV's? Here's some info below.
                    http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
                    http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
                    • 11055 ☆ A M B ☆
                    • 3,112 Posts
                    Ow, ok. Thx.

                    Another question: what is the parameter to show "the next d days" rather than current-month output in `list` display?
                      Rico
                      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                      MODx is great, but knowing how to use it well makes it perfect!

                      www.virtudraft.com

                      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                      Maintainter/contributor of Babel

                      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                      • 11055 ☆ A M B ☆
                      • 3,112 Posts
                      About the time &offset, do you think we should use it?
                      I guess if we have set our Google Cal from its setting (http://www.google.com/support/calendar/bin/answer.py?answer=83117#), so the &offset should be `0`. No?

                      About the google’s server timezone:
                      http://www.webmasterworld.com/forum89/7451.htm
                        Rico
                        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                        MODx is great, but knowing how to use it well makes it perfect!

                        www.virtudraft.com

                        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                        Maintainter/contributor of Babel

                        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.