We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10487 MODX Staff
    • 1,535 Posts
    I’m trying to set up some chunks so I can start to work on a new template for the calendar, the problem I’m having (and it’s probably my own idiocy) is that I can’t seem to use my newly created chunk.

    My chunk is called ’calTemplate’ and I want to assign this to the tplTemplate variable. Now, this is probably where I’m going wrong, as I’m calling this inside the snippet using:

    $tplTemplate=$modx->getChunk('calTemplate');


    Now, if I include this before the new Calendar has been created, I get a blank page when I go to my calendar page. If I include it after the Calendar has been created, it defaults to the template chunks set through the calendar class.

    Any advice on this would be brill as I think I’m on one of my "let’s make it more complicated than it really is" trips. wink

    Thanks, Garry

      Garry Nutting
      Senior Developer
      MODX, LLC

      Email: [email protected]
      Twitter: @garryn
      Web: modx.com
      • 32241
      • 1,495 Posts
      EHmmm.. That’s not how you use chunk as the template for the calendar snippet.

      Call it on the snippet call. Here is an example for it:
      [!Calendar? &tplTemplate=`calTemplate`!]
      


      With that, the snippet will automatically use the chunk as the template for tplTemplate.

      Have Fun with templating it...
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 10487 MODX Staff
        • 1,535 Posts
        Cheers, Wendy. I knew I was having one of my moments ... rolleyes
          Garry Nutting
          Senior Developer
          MODX, LLC

          Email: [email protected]
          Twitter: @garryn
          Web: modx.com
          • 10487 MODX Staff
          • 1,535 Posts
          Just an idea for a future release:

          Allow a name for a css stylesheet to be specified via the snippet call, as long as it was available in the calendar’s ’styles’ folder, this could be sucked in using the regClientCSS() API function in the snippet itself.

          I think it would complement the templating flexibility currently available and result in less editing of the core snippet code.
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 4018
            • 1,131 Posts
            Quote from: Djamoer at Feb 02, 2006, 04:53 PM

            If you just call it as [!Calendar!], then it’s suppose to work just fine, it will automcatically use all the default templating included with the snippet. If you want to create your own design, then you can read the parameter option on the snippet, and assign whatever chunk to the template, and customize it to whatever you like.

            FYI, the templating system is really flexible, so if you can come up with another good desing, it won’t hurt for me to replace the default template right now, because I do think the current template looks ugly.

            Thanks

            Err...ok...

            Well, for me, when I use just [!Calendar!] on a page the calendar comes up but looking at the code it doesn’t appear that the CSS script line is being inserted. Nor is the Cal_OpenEditor javascript function. Hmm...am I missing something here? Oh, and I did add in the fix as recommended too. Hmm...
              Jeff Whitfield

              "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
              • 32241
              • 1,495 Posts
              Hem that’s weird. Did you see any javascript being inserted at the end of your html code jeff? It’s suppose to be the required dom tooltip javascript library being added before the end of the body tag. The jsCalendar script and the required css to be inserted on the head tag. Which one that you’re unable to see?

              @garryn: I will make sure of that then.
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 32241
                • 1,495 Posts
                Edge and Garry, thanks for the kind word smiley I miss that reply for some reason.
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 4018
                  • 1,131 Posts
                  Quote from: Djamoer at Feb 02, 2006, 09:05 PM

                  Hem that’s weird. Did you see any javascript being inserted at the end of your html code jeff? It’s suppose to be the required dom tooltip javascript library being added before the end of the body tag. The jsCalendar script and the required css to be inserted on the head tag. Which one that you’re unable to see?

                  See the page here:

                  http://www.ultragroups.com/calendar.html

                  This is just a simple template with just a single content area. Weird! Not sure why this is happening! Ugg!
                    Jeff Whitfield

                    "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                    • 32241
                    • 1,495 Posts
                    Bravado, did you use the files provided on this message?

                    http://modxcms.com/forums/index.php/topic,2318.msg18725.html#msg18725

                    Try to download it again and remove the current files and replace it with the files on this post.

                    If it’s not working, you might want to check the reCLientStartupScript and the regClientScript API. CHeck whether it works just fine or not, because all the calendar is showing up right except that all the necessary css and javascript is not being included on the page at all, even the one located at the last line of the body tag.

                    I tried to install this on a new system, and it’s having a problem. Gimme a sec
                      Wendy Novianto
                      [font=Verdana]PT DJAMOER Technology Media
                      [font=Verdana]Xituz Media
                      • 32241
                      • 1,495 Posts
                      OK Jeff, here is the fix.

                      http://modxcms.com/forums/index.php/topic,1942.msg18781.html#msg18781

                      It’s a problem on MODx API, but there is a workaround that most the tester use without realizing it wink I think it’s becoming a habit for us to do this, even when we are debuging/testing a code, but it seems to me that you have a different habit not to do this on production site. So the "this" will be something that was explained on the above link. grin
                        Wendy Novianto
                        [font=Verdana]PT DJAMOER Technology Media
                        [font=Verdana]Xituz Media