We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41049
    • 35 Posts
    Hi,
    I am quite new to modx and mxcalendar ind I would like to create an custom XML feed for my calendar. I would like to know how should my xml look like, does any one have some example xml feed for this calendar.

    My xml feed should have title, link to resource, start/end date and hour.

    Thanks in advance!

    Denis
      • 37984
      • 215 Posts
      The best way to accomplish this would be to use a call that outputs a list calendar, and then use a custom list item chunk that formats each event, as well as custom chunks to format the list output. Here's a basic walkthrough:

      1. Create a resource that will serve as your XML file - make sure to set your content type as XML and turn off any Rich Text editors, as they will add formatting you don't want.

      2. Create your custom chunks - you will need one for tplListItem, tplListHeading and tplListWrap.

      3. Put your main mxCalendar call in the content area of this resource; as stated above, you should set the displayType to list, and make sure to include your custom chunks. You should also make sure that you set the eventListLimit parameter pretty high so that your XML file contains most of the events coming soon. A sample call would look something like this:

      [[!mxCalendar? &displayType=`list` &tplListItem=`CustomListItemChunk` &tplListHeading=`CustomListHeadingChunk` &tplListWrap=`CustomListWrapChunk` &eventListLimit=`75`]]


      I can help with a more detailed explanation if needed, but this should get you started at least.
        Jesse Couch
        MODX Aficionado, Front-End Designer & Developer
        http://www.designcouch.com
        • 41049
        • 35 Posts
        Ok, not shure if I got this right. I am quite new to this.
        I don't know where to put my xml. To mxCalendar feed as link or in this resource I created?

        I created resource as XML with a call that includes three chunks. As a resoult I got this statement
        "This XML file does not appear to have any style information associated with it. The document tree is shown below."

        I think I didn't write my chunks corectly smiley

        I have sample xml like this..
        <calendar>
            <event>
                <title>test3</title>
                <description>test</description>
                <categoryid>1</categoryid>
                <startdate>1355906700</startdate>
                <enddate>1355903100</enddate>
            </event>
        </calendar>
        



        I think I need more detailed explanation please.
          • 37984
          • 215 Posts
          Denist,

          No worries. You need to use each chunk for different things.

          The CustomListWrapChunk needs to be all of the stuff that goes at the head and foot of your xml code - specifically for you, everything wrapping your actual events. An example would look like this:

          <?xml version="1.0"?>
          <calendar>
              <events>
                  [[+eventList]]
              </events>
          </calendar>


          [[+eventList]] is the placeholder for all of your events.

          The CustomListHeadingChunk in this case should simply be a blank chunk. It typically provides the month separators in list view for mxCalendar, but you most likely won't need those in your XML file. Leaving it blank eliminates the display of this in your XML file. If you do want the months, feel free to structure this chunk however you would like.

          The CustomListItemChunk should be the structure for each individual event and would have a structure something like this:

          <event>
              <title>[[+title]]</title>
              <description>[[+description]]</description>
              <categoryid>[[+category]]</categoryid>
              <startdate>[[+startdate:date=`%b %e`]]</startdate>
              <enddate>[[+enddate:date=`%b %e`]]</enddate>
          </event>


          Note that I've used the standard mxCalendar placeholders, and those will be filled in with the appropriate information depending on the events you create.

          I also forgot to mention that you need to create a blank template for this Resource. The template should just contain the MODX content placeholder (like this:)

          [[*content]]


          Hope this helps!
            Jesse Couch
            MODX Aficionado, Front-End Designer & Developer
            http://www.designcouch.com
            • 41049
            • 35 Posts
            O now I got it, but is yust one more question. Where it reads my xml from. I got this error. In mxCalendar i put my xml path to feeds..

            This page contains the following errors:

            error on line 1 at column 1: Document is empty
            Below is a rendering of the page up to the first error.


            Edit:
            I put my xml lines in the resource before the mxCalendar call and i got out unformated data and an error.
            So that means that feed in mxcalendar is not working.

            This page contains the following errors:

            error on line 11 at column 1: Extra content at the end of the document
            Below is a rendering of the page up to the first error.

            6 test3 test 1 1355906700 1355903100
            [ed. note: denist last edited this post 11 years, 4 months ago.]
              • 41049
              • 35 Posts
              Stil need to know where to put XML (mxCalenda feed ?) and how to eliminate an error that I got.

              Thanks!
                • 37984
                • 215 Posts
                Sorry, Denist - was out for a week to visit family. No computer was one of the rules (BOOOOO).

                A few questions - first off, I'm a bit confused as to what you mean by saying you put your XML path to feeds. Can you please elaborate? To my knowledge, there is not a setting in mxCalendar that allows this. The feeds in mxCalendar are solely for bringing in events from an outside source (another calendar) via either an XML feed or iCal feed, but not for outputting a feed.

                There should be no XML in the resource content area of your resource; it should just be the mxCalendar call with the appropriate custom chunks specified. The chunks provide all the code (assuming you created then per my comments above), and MODX assembles the page on the fly whenever a user visits the page.

                If you could post all of the content you have in your resource content area, and I can instruct a bit more clearly.
                  Jesse Couch
                  MODX Aficionado, Front-End Designer & Developer
                  http://www.designcouch.com
                  • 41049
                  • 35 Posts
                  Hi!

                  Yes I ment inporting feed. Something like iCal but custom. So that I create an XML by hand (e.g. in notepad laugh ) and then import it in mxCalendar. And I do not know how to prepare XML to inport into mxCalendar.

                  For second thing i managed to corectly display already published events.

                  Regards!
                    • 37984
                    • 215 Posts
                    Importing custom XML is very tricky. Standard format stuff like iCal is easier as you can plan for the elements being used in the code - with XML, it all depends on the person writing the code - there is no standard. I would direct your XML question to Charles (the developer of mxCalendar). He could probably more ably answer that particular question.
                      Jesse Couch
                      MODX Aficionado, Front-End Designer & Developer
                      http://www.designcouch.com
                    • Will document the steps on this shortly.
                        Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
                        Visit CharlesMx.com for latest news and status updates.