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

    Hi,
    I've got a local install of Modx Revolution 2.8.2.
    I loaded mxcalendar through package management.
    I'm able to create events, calendars and categories through the manager but attempting to display a calendar on the page results in an error.
    It works OK on an install in some remote webspace that I have so I guess it's maybe some kind of configuration thing with xampp, but it's the only package that hasn't worked of the ones I've installed so far. Just wondered if the messages indicated anything obvious.
    Regards
    Allan


    Running Xampp 1.8.2
    php 5.4.16
    Windows NT 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) i586
    Database server

    Server: 127.0.0.1 via TCP/IP
    Server type: MySQL
    Server version: 5.5.32 - MySQL Community Server (GPL)
    Protocol version: 10

    Server charset: UTF-8 Unicode (utf8)

    Web server

    Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16
    Database client version: libmysql - mysqlnd 5.0.10 - 20111026 -

    Packages installed.

    archivist 1.2.4
    Articles 1.6.8
    ClientConfig 1.1.2
    CodeMirror 2.2.0
    DefaultResourceGroup 1.0.1
    FileDownload R 1.1.5
    getpage 1.2.3
    getresources 1.6.0
    Login 1.8.1
    mxCalendar 1.1.9
    phpthumbof 1.4.0
    quip 2.3.2
    taglister 1.1.7
    TinyMCE 4.3.3
    Wayfinder 2.3.3

    Calling mxcalendar snippet(id 38) with command:
     [[!mxcalendar?]]

    Result:


    Notice: Undefined variable: properties in C:\xampp\htdocs\wacsites\core\cache\includes\elements\modsnippet\38.include.cache.php on line 109

    Notice: Undefined index: dt in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 392

    Notice: Undefined index: dt in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 392

    Notice: Undefined variable: debug in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 400

    Notice: Undefined index: dt in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 406

    Notice: Undefined index: cid in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 421

    Notice: Undefined index: cid in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 422

    Notice: Undefined index: cid in C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php on line 423

    Notice: Undefined index: cid in C:\xampp\htdocs\wacsites\core\cache\includes\elements\modsnippet\38.include.cache.php on line 398



    This question has been answered by multiple community members. See the first response.

    • Remove the ? from the basic mxCalendar snippet call unless you're adding parameters.

      The errors say they're looking for variables, yet you haven't defined any.

      See the comments here: http://charlesmx.com/software/mxcalendar-revo.html

      And also search the forum for mxCalendar to see the various solutions for whatnot that have been posted in the past. mxCalendar is powerful, yet a little finicky sometimes.
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 42511
        • 60 Posts
        Thanks very much for the pointers,
        I've been struggling with this for a while now and have attempted to search the forums for information but it have trouble searching for the specific detail that I'm looking for. I uninstalled mxcalendar, tried Churcheventscalendar, decided that wasn't suitable, reinstalled mxcalendar(clearing down caches, logging out etc, before after all actions) and attempted to trace the source of the problem without really knowing what I'm looking for smiley.
        I've tried removing the '?' from the call - but unfortunately I still get the notices and the dodgy output :-(
        I'm convinced that it's probably a problem stemming from my having something set up wrongly in one of the configuration files or maybe a problem with Ajax.
        I've tried putting a call to the 1.7.1 script library in the page headers, but that doesn't seem to have worked.
        I installed Firebug and got a little more info but not sure how to interpret it apart from the fact it seems to indicate that something is not quite working as expected smiley(snippet is now id 49 as Formit and colorpicker also installed now!)

        But looking back I found the debug command for the date - which seems to point at a server problem(now I just need to work out where to look)
        Thanks very much again,
        Allan
        :
        Filtering calendar date SQL range with: 01/01/1970 through 02/12/1970

        SQL: SELECT mxCalendarEvents.* FROM `mod1_mxcalendars_events` AS `mxCalendarEvents` WHERE ( ( `mxCalendarEvents`.`repeating` = 0 AND `mxCalendarEvents`.`enddate` >= 0 AND `mxCalendarEvents`.`enddate` <= 3628800 OR ( `mxCalendarEvents`.`repeating` = 1 AND `mxCalendarEvents`.`repeatenddate` >= 0 ) ) AND `mxCalendarEvents`.`context` IN ('','web') AND `mxCalendarEvents`.`active` = 1 ) ORDER BY startdate ASC LIMIT 99

        mxCalendars Query started @0.039999961853027 and ended @0.039999961853027 for total processing time of 0 seconds

        Returned Events: 0
        mxc result set loop started @0.039999961853027 and ended @0.039999961853027 for total processing time of 0 seconds
        generate list of all columns for sorting started @0.039999961853027 and ended @0.039999961853027 for total processing time of 0 seconds
        No valid dates returned.


        <div class="container">

        <b>Notice</b>: Undefined variable: properties in <b>C:\xampp\htdocs\wacsites\core\cache\includes\elements\modsnippet\49.include.cache.php</b> on line <b>109</b>



        <b>Notice</b>: Undefined index: dt in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>392</b>



        <b>Notice</b>: Undefined index: dt in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>392</b>



        <b>Notice</b>: Undefined variable: debug in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>400</b>



        <b>Notice</b>: Undefined index: dt in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>406</b>



        <b>Notice</b>: Undefined index: cid in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>421</b>



        <b>Notice</b>: Undefined index: cid in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>422</b>



        <b>Notice</b>: Undefined index: cid in <b>C:\xampp\htdocs\wacsites\core\components\mxcalendars\model\mxcalendars\mxcalendars.class.php</b> on line <b>423</b>



        <b>Notice</b>: Undefined index: cid in <b>C:\xampp\htdocs\wacsites\core\cache\includes\elements\modsnippet\49.include.cache.php</b> on line <b>398</b>

        <div id="calbody" style="">
        <a href="index.php?id=1&conf=%2Cweb&dt=2013-07" class="mxcnav sm" id="mxctodaylnk">Today</a>
        <span class="nomargins">
        <a href="index.php?id=1&conf=%2Cweb&dt=2013-06" class="mxcnav" id="mxcprevlnk"><</a>
        <a href="index.php?id=1&conf=%2Cweb&dt=2013-08" class="mxcnav" id="mxcnextlnk">></a>
        </span>
        <span class="label">July 2013</span>
        <table id="Wed" class="Wed1970">
        <tr id="" class="">
        <td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td><td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td><td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td><td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td><td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td><td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td><td id="" class="mxcdow">
        mxcalendars.label_dow_
        </td>
        </tr><tr id="mxcWeek0" class="Wednesday07">
        <td id="dom-Thursday01" class="noEvents ncm">
        <!-- day of month label -->
        <div class="datestamp">Jan 1</div>
        <!-- event listing container -->
        <div id="" class="event">
        </div>
        </td><td id="dom-Friday02" class="noEvents ncm">
        <!-- day of month label -->
        <div class="datestamp"> 2</div>
        <!-- event listing container -->
        <div id="" class="event">
        </div>
        </td><td id="dom-Saturday03" class="noEvents ncm">
        <!-- day of month label -->
        <div class="datestamp"> 3</div>
        <!-- event listing container -->
        <div id="" class="event">
        </div>
        </td><td id="dom-Sunday04" class="noEvents ncm">
        <!-- day of month label -->
        <div class="datestamp"> 4</div>
        <!-- event listing container -->
        <div id="" class="event">

        Seems to point at this:
        public function getEventCalendarDateRange($activeMonthOnlyEvents=false){
        $startDate = $_REQUEST['dt'] ? $_REQUEST['dt'] : ($this->config['dt'] ? $this->config['dt'] : strftime('%Y-%m'));
        $mStartDate = strftime('%Y-%m',strtotime($startDate)) . '-01 00:00:01';
        $nextMonth = strftime('%Y-%m', strtotime('+1 month',strtotime($mStartDate)));
        $prevMonth = strftime('%Y-%m', strtotime('-1 month',strtotime($mStartDate)));
        $startDOW = strftime('%u', strtotime($mStartDate));
        $lastDayOfMonth = strftime('%Y-%m',strtotime($mStartDate)) . '-'.date('t',strtotime($mStartDate)) .' 23:59:59';
        $startMonthCalDate = $startDOW <= 6 ? strtotime('- '.$startDOW.' day', strtotime($mStartDate)) : strtotime($mStartDate) ;
        $endMonthCalDate = strtotime('+ 6 weeks', $startMonthCalDate);
        if($debug) echo 'Active Month Only: '.$mStartDate.' :: '.$lastDayOfMonth.' All displayed dates: '.strftime('%Y-%m-%d',$startMonthCalDate).' :: '.strftime('%Y-%m-%d',$endMonthCalDate).'
        ';
        if($activeMonthOnlyEvents) return array('start'=>strtotime($mStartDate), 'end'=>strtotime($lastDayOfMonth)); else return array('start'=>$startMonthCalDate, 'end'=>$endMonthCalDate);
        }


        All of which seems to say that this isn't working with the way I've (mis?)configured Apache
        [ed. note: allan1 last edited this post 10 years, 9 months ago.]
        • So, you do want to use the ajax? You'll need to set up the ajax resource then, and call it in the snippet call.

          Below, I've got an ajax resource for a detail window to show when an event is clicked in the calendar. Calendar is set to list view, but you can set it to calendar if that's what you want. I've also got duplicated mxCalendar chunks being called in for templating. I've eliminated the list heading with the `null`, and again, you don't have to do that.

          ajax resource (hidden from menu)
          [[!mxcalendar? &displayType=`detail`]]


          Calendar Resource:
          [[!mxcalendar? &eventListlimit=`10` &displayType=`list` &isLocked=`1` &tplListHeading=`null` &elStartDate=`now` &dir=`DESC` &tplListItem=`tplListItemCustom` &tplListWrap=`tplListWrapCustom` &tplCategoryWrap=`tplCategoryWrap` &tplCategoryItem=`tplCategoryItem` &ajaxResourceId=`68` &modalView=`1`]]


          I don't know why the defaults don't take well, but calling them directly seems to work.

          You could also edit and add a new property set for the mxCalendar and use
          [[!mxCalendar@newPropertySet]]
          instead. That seems to work nicely.

          If you search frogabog and mxCalendar you'll find a number of posts discussing mxCalendar, and I believe a downloadable copy of the propertySet that I used on another project that you could import into the snippet. I couldn't find it quickly, but there's enough discussion to keep you busy while I continue to look. The site that I used it on was hijacked by someone who was going to "rebrand", who then used Wix hosting for the site... (site owners aren't happy, nothing works... and the rebranding "expert" quit on them - ahhh sometimes life is so good watching the idiots play with their toes. And no, I refuse to help them for free). As such, I can't go fetch the property set easily but I'm sure I've got it on one of these drives here...
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 42511
            • 60 Posts
            Hi,
            Yes I wanted to use the Ajax stuff but when I couldn't get it to work I started trying to just use the simple call.
            I had made a page for the modal call - but I didn't have any code in it - which might explain why it wasn't working smiley
            I'm going to have to go and cook tea, so apologies in advance if I reply even more slowly than previously.
            Thanks very much once again for all the help.
            regards
            Allan
              • 42511
              • 60 Posts
              Hi,
              with the examples that Frogabog has posted I have managed to get the modal window functioning for the event list on my local install(for which many thanks). It has got both the list format and calendar format working modally on the remote site.
              I suspect that I may have some kind of corrupted installation with the local install into xampp as it won't let me add repeating events in the manager and the default view calendar won't display at all.
              It still gets all of the errors posted above, I can't sus out why the label at the top of the table displays 'July 2013' but then the grid has dates for January and February 1970.
              I think I should maybe zap this install and try again.
              cheers
              Allan
              • Is that all the errors you are getting, though worth noting that since they are notices they should not prevent the script from executing properly. I'd be more curious to see what the values are from the debug, if you set a parameter for debug to 1 (one) you should get a fair amount of additional output on the page if you can post that back it would help.

                [[mxcalendars?&debug=`1`]]


                I need to clean up the code so the notices do not get logged, so I will add that to my short list as well.

                Cheers
                  Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
                  Visit CharlesMx.com for latest news and status updates.
                  • 42511
                  • 60 Posts
                  Thanks Charles,
                  I'll try to do that later. Have to go and do the day job now.
                  regards
                  Allan
                  Hi,
                  been trying to post with a file attached but it just shoots me back to the first post. I'll try again. [ed. note: allan1 last edited this post 10 years, 9 months ago.]
                    • 42511
                    • 60 Posts
                    Hi,
                    I'll try pasting it instead. Don't know whence the dodgy dates in the sql query are derived.
                    Thanks very much if you manage to take a look.
                    regards
                    Allan

                    array(32) { ["theme"]=> string(7) "default" ["displayType"]=> string(8) "calendar" ["elStartDate"]=> string(3) "now" ["elEndDate"]=> string(8) "+4 weeks" ["eventListlimit"]=> string(1) "5" ["tplListItem"]=> string(11) "tplListItem" ["tplListHeading"]=> string(14) "tplListHeading" ["tplListWrap"]=> string(11) "tplListWrap" ["tplDetail"]=> string(9) "tplDetail" ["dateformat"]=> string(8) "%Y-%m-%d" ["timeformat"]=> string(8) "%H:%M %p" ["dateseperator"]=> string(13) "resultWrapTpl" ["activeMonthOnlyEvents"]=> bool(false) ["hightlightToday"]=> bool(true) ["todayClass"]=> string(5) "today" ["noEventClass"]=> string(14) "mxcDayNoEvents" ["hasEventsClass"]=> string(9) "mxcEvents" ["tplEvent"]=> string(8) "tplEvent" ["tplDay"]=> string(6) "tplDay" ["tplWeek"]=> string(7) "tplWeek" ["tplMonth"]=> string(8) "tplMonth" ["tplHeading"]=> string(10) "tplHeading" ["debug"]=> string(1) "1" ["showCategories"]=> bool(true) ["tplCategoryWrap"]=> string(15) "tplCategoryWrap" ["tplCategoryItem"]=> string(15) "tplCategoryItem" ["gmapAPIKey"]=> string(10) "gmapAPIkey" ["gmapRegion"]=> string(0) "" ["sort"]=> string(4) "name" ["dir"]=> string(4) "DESC" ["modalView"]=> string(5) "false" ["debugTimezone"]=> string(4) "true" }

                    Filtering calendar date SQL range with: 01/01/1970 through 02/12/1970

                    SQL: SELECT mxCalendarEvents.* FROM `mod1_mxcalendars_events` AS `mxCalendarEvents` WHERE ( ( `mxCalendarEvents`.`repeating` = 0 AND `mxCalendarEvents`.`enddate` >= 0 AND `mxCalendarEvents`.`enddate` <= 3628800 OR ( `mxCalendarEvents`.`repeating` = 1 AND `mxCalendarEvents`.`repeatenddate` >= 0 ) ) AND `mxCalendarEvents`.`context` IN ('','web') AND `mxCalendarEvents`.`active` = 1 ) ORDER BY startdate ASC LIMIT 99

                    mxCalendars Query started @0.031199932098389 and ended @0.031199932098389 for total processing time of 0 seconds

                    Returned Events: 0
                    mxc result set loop started @0.031199932098389 and ended @0.031199932098389 for total processing time of 0 seconds
                    generate list of all columns for sorting started @0.031199932098389 and ended @0.031199932098389 for total processing time of 0 seconds
                    No valid dates returned.UI Rendering started @0.031199932098389 and ended @0.20280003547668 for total processing time of 0.1716001033783 seconds

                    mxCalendar processed in 0.26519989967346 seconds

                    Today < > July 2013

                    mxcalendars.label_dow_


                    mxcalendars.label_dow_


                    mxcalendars.label_dow_


                    mxcalendars.label_dow_


                    mxcalendars.label_dow_


                    mxcalendars.label_dow_


                    mxcalendars.label_dow_

                    Jan 1




                    [ed. note: allan1 last edited this post 10 years, 9 months ago.]
                    • discuss.answer
                      • 42511
                      • 60 Posts
                      Hi,
                      Another update. I uninstalled mxcalendar and dropped the tables from the database, ran repair tables. Cleared all the cache files etc. Reinstalled mxcalendar and still get the same results, except it doesn't display the debug stuff anymore.(Not sure what I've done to stop that). had a poke about in the code and found a line in the snippet that said debug =`false` so I changed that to true. Then when I ran it it listed the days of the week and what I think must be day/month figures - only they look as though they're in month/day form which doesn't match my UK timezone. So maybe there's some kind of timezone confusion somewhere in my install. Server logs all look ok in terms of date format so I'm guessing it must be somewhere in modx - just not sure whereabouts yet.
                      cheers
                      Allan