We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30128
    • 78 Posts
    I get a problem when trying to add multiple events to the same date though.

    First of all, I need to give write permission to the assets/snippets/CALx folder, I don’t think this was mentioned anywhere.

    Now I get this error:
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - You have an error in your SQL syntax; check the 
    manual that corresponds to your MySQL server version for the right syntax to use near 
    'and STR_TO_DATE(`mydb`.modx_site_tmplvar_contentvalues.value, '%d-%m-%Y')<='200' at line 1 »
          
    SQL:  SELECT * FROM `mydb`.modx_site_tmplvar_contentvalues 
    WHERE (`mydb`.modx_site_tmplvar_contentvalues.tmplvarid= and STR_TO_DATE(`mydb`.modx_site_tmplvar_contentvalues.value, '%d-%m-%Y')<='2007-08-10') 
          [Copy SQL to ClipBoard]
     
    Parser timing
      MySQL: 	0.0189 s	(15 Requests)
      PHP: 		0.0514 s	 
      Total: 	0.0703 s 


    the file multiEvents.txt is now created, and in my situation contains the the text "60".

    Can I link this calendar to blog-posts? Can I include the template-variables in the form for a new blog-post such that posts where these are filled in are added to the calendar, while other posts become normal news?

    It would be cool if we could AJAX-ify the links to next and previous year/month though, so it wasn’t neccessary to reload the whole page.
      • 25307
      • 114 Posts
      Yup, I tried to chase down what in the world was left out in the instructions. The directory needing write permission was ultimately the last thing I did before actually seeing the output working. I think a lot of this very well snippet gets lost in translation. I’d be happy to help out with the English localization for the upcoming versions of the snip, including code comments, style info and labels, and installation instructions and usage documentation.
        • 13320
        • 245 Posts
        Hi !
        I though that, as you had managed to install this snip, you had the write permissions to the folder so I did not mention it in the documentation.
        About your error :Quote from: tjalve at Aug 10, 2007, 01:56 PM
        `mydb`.modx_site_tmplvar_contentvalues.tmplvarid=???? and
        there is a problem with your template variables. I think you made the mistake when you wrote the name of the template var, so that CALx is not able to find the variable ID. Check its name - if you don’t manage to find the error, you can post screenshots of your var declarations - with the bit you posted, i cannot know which variable isn’t identified.
        Check that number 60 corresponds to the document entitled "Eventslisting"

        Yop, you can associate the calendar with blog-posts and i cannot see why you couldn’t include the template variables in the form.

        Concerning AJAX, I’m currently working real hard on it but, as I only got two arms, dunno when it’s ready. ;p
          [b]D
          • 30128
          • 78 Posts
          a close look at my error message reveals this:
          STR_TO_DATE(`mydb`.modx_site_tmplvar_contentvalues.value, '%d-%m-%Y')<='2007-08-10')


          so I guess MODx refuse to have anything to do with 2007 days in any month :p

          However, I’m not sure where this comes from. Presumably I’ve chosen the wrong format in the Date Format widget for my Template Variables. I went with the default format which were already present and is
          %A %d, %B %Y
          I have no clue what this means though..
            • 30128
            • 78 Posts
            So, making these changes in function createLinkMultiEventPageTV on line 1380 in CALx.class.php did the tric:
            		$sqlStartEvent = 	' SELECT * '.
            						' FROM '.$this->tmpvar_content.
            						' WHERE ('.$this->tmpvar_content.'.tmplvarid='.$TVstartdateid.' and '.
            #						'STR_TO_DATE('.$this->tmpvar_content.'.value, \'%d-%m-%Y\')<=\''.$dateEvent.'\')';
            						'STR_TO_DATE('.$this->tmpvar_content.'.value, \'%Y-%m-%d\')<=\''.$dateEvent.'\')';
            							
            		$sqlEndEvent = ' SELECT * '.
            						' FROM '.$this->tmpvar_content.
            						' WHERE ('.$this->tmpvar_content.'.tmplvarid='.$TVenddateid.' and '.
            #						'STR_TO_DATE('.$this->tmpvar_content.'.value, \'%d-%m-%Y\')>=\''.$dateEvent.'\')';
            						'STR_TO_DATE('.$this->tmpvar_content.'.value, \'%Y-%m-%d\')>=\''.$dateEvent.'\')';
            


            The problem now is that only one of these "multiEvents" are active - whichever day I click on that has multiple events, I only get the results for one of them. I have four EventListing documents in my calendar root, but all but one are Un-Published. The one that is published is the one with the ID from the multiEvents.txt file in the snippets/CALx folder.

            How is this multiEvents supposed to work? I’m not supposed to touch them or alter publish/unpublish date or anything, right?
              • 24393
              • 83 Posts
              I am having this same problem with the SQL error. My TV’s are correctly defined in the snip, and i have two test documents created. I don’t want to loose the multiple events function like tjalve!
                stevesunderland.com
                GRAPHICS | INTERACTIVE | MARKETING
                xhtml + ajax + seo websites powered by modx
                • 5253
                • 17 Posts
                heyya!

                thanks for your quick response.
                I’ll try to describe the problem a little bit more detailed:
                If you click on a date in the calendar, a little info box appears. if there are more than one event, a click on "Cliquez ici pour plus de détails" will load a new site with a list of all events on this date. 3 GET-Variables are within the URL. When you click on one special evenet, the correct URL without the 3 GET-Variables is loaded. Everything works fine.
                But:
                If there is only one event and you click on "Cliquez ici pour plus de détails" the event’s site is loaded with the 3 GET-Variables.

                You know, this is not a real problem only for Google and the topic "duplicate content" it can be a bit problematical.

                Doesn’t matter anyway...More important is the subfolder support wink

                but first: enjoy your weekend smiley
                  *there are no strangers - just friends who never met*
                  • 30128
                  • 78 Posts
                  @rajfantastic: I posted in my last post how I fixed the SQL-errors, it would probably work for you too.

                  Since I want to connect this to blog posts, and NewsPublisher doesn’t support the addition of other TV’s (so I’ll not be able to add the startDate and endDate for CALx when I’m creating a new blog post through the front end), I tried then to remove the TV’s, this seems to use the publish/unpublish dates instead.

                  However the functionality seems a bit buggish and random: first of all, all blog posts now needs an unpublish-date. If I don’t include it, they events will fill up my calendar(s) and last eternally. However I don’t really want my blog posts to become unpublished.

                  Moreover, a future event, added now as a blog post with a date set sometime in the future, works (although it’s a bit counter-intuitive to use future publish-dates, since the blog post will become published immediately). However, if there are a multiEvent on a future date, when clicking on it no events will be listed ("No events schedule for this jorney").

                  Lastly, the monthly view no becomes cluttered with ("No events schedule for this jorney") entries for all days without any events.

                  No, here comes my last point: This is ment as positive criticism only smiley CALx is great! And it also seems to be the only alternative going forward for getting a calendar in MODx. I’ve given up the GoogleEvents since my webserver wont support cURL. I hope your’re enjoying coding on CALx and that it will continue to improve and become a solid Calendar tool for many purposes. Thx!
                    • 24393
                    • 83 Posts
                    @tjalve: your "fix" for the SQL error breaks multi-events, which is essential to the calendar application.

                    this is a really well-written calendar app, and i really want it to work for my website!
                      stevesunderland.com
                      GRAPHICS | INTERACTIVE | MARKETING
                      xhtml + ajax + seo websites powered by modx
                      • 13320
                      • 245 Posts
                      Hey,

                      It’s a little late here (France) and, has i’m getting tired, I will answer more acurately tomorrow but, a few words :
                      Quote from: tjalve at Aug 10, 2007, 08:01 PM

                      However the functionality seems a bit buggish and random:

                      Please take a closer look at the documentation, especially before you change things. As i originally use the pub and unpub dates, it’s perfectly normal that, if you remove TV’s, pub/unpub dates should be used. At first, the pub_date was considered by CALx as the start of event, and the unpub date as the end, so you have to specify an unpub date. It will not mean that the event is removed from the calendar, it will not disappear.

                      As indicated at the end of the documentation all the events are shown by CALx.

                      @tjalve : First of all, leave the default format for the dates of the TV’s. On my MODx version :
                      %A %d, %B %Y
                      .
                      Then, about this : Quote from: tjalve
                      STR_TO_DATE(`mydb`.modx_site_tmplvar_contentvalues.value, ’%d-%m-%Y’
                      , MySQL formats dates according to my pattern, that is to say
                      ’%d-%m-%Y’
                      .

                      Please make sure that you understand a fragment of code before changing it.
                      As for your problem, that may be caused by the server itself or a different version of MySQL. I’m not sure about this but some default feature may be set differently.
                        [b]D