We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15152
    • 360 Posts
    I’d like to completely re-style the date output in ditto. Unfortunately I can’t seem to figure it out. I’d like to use a calendar page look with a month abbreviation and the day of the month and drop everything else. Like this:

    Can someone point me in the right direction. I’ve looked through the forums but haven’t seen this issue.

    Thanks, Jack
      There are no boring projects. Only boring executions. ~ Etzkorn
      www.impress-design.com
      • 18397
      • 3,250 Posts
      There should be a thread that discusses breaking up the date using PHx in this forum. If you find it, please post the link here so I can add it to the Ditto support site.
        • 15152
        • 360 Posts
        Thanks Mark. I’ll look.
          There are no boring projects. Only boring executions. ~ Etzkorn
          www.impress-design.com
          • 15152
          • 360 Posts
          OK. I’ve found this, but I’m not sure it helps:

          You could also use PHx to format the date in the tpl:
          Code:

          [*createdon:date=`%d.%m.%Y`*]
            There are no boring projects. Only boring executions. ~ Etzkorn
            www.impress-design.com
            • 15152
            • 360 Posts
            I believe I have the answer:

            <div class="date">
            <div class="day">[+createdon:date=`%A`+]</div>
            <div class="month">[+createdon:date=`%B`+]</div>
            <div class="year">[+createdon:date=`%Y`+]</div>
            </div>

            Control the output and display by using the formats here:
            Change the %B to %b per one of the options available on http://us2.php.net/strftime
              There are no boring projects. Only boring executions. ~ Etzkorn
              www.impress-design.com
              • 18397
              • 3,250 Posts
              Yes, that was the answer I was referring to. Then you just use CSS to style it like your example image.
                • 15152
                • 360 Posts
                This would be nice as part of the documentation. Whoever is writing the book on MODx would make a lot of us happy including this kind of info!
                  There are no boring projects. Only boring executions. ~ Etzkorn
                  www.impress-design.com
                  • 15152
                  • 360 Posts
                  Anyone--
                  I'm still not getting it to show the info properly. This is what I have:
                  <div class="nl_summaryPost2">
                  <h1><a href="[~[+id+]~]" title="[+title+]">[+title+]</a></h1>
                  <div class="nl_info2" >
                  <div class="date">
                  <div class="month">[+createdon:date=`%b`+]</div>
                  <div class="day">[+createdon:date=`%d`+]</div>
                  <div class="year">[+createdon:date=`%Y`+]</div>
                  </div>
                  </div>
                  [+summary+]
                  </div>
                  <br /><br />

                  You can see here http://jackmcdaniel.net that the date info isn’t coming through.

                  When I pull the calls out and put in dates / info it looks correct, so for some reason I’m not pulling the info. In fact, do a view source and nothing is there.

                  Thanks for any help.
                    There are no boring projects. Only boring executions. ~ Etzkorn
                    www.impress-design.com
                    • 18397
                    • 3,250 Posts
                    Try upgrading to Ditto 2.1 and then adding &hiddenFields=`createdon` if it still does not work.
                      • 15152
                      • 360 Posts
                      OK - here’s the final solution. First, as Mark suggested, you have to use version 2.0 or later of Ditto. My site is older and was actually running version 1. This is the code to use in place of the date placeholder (+Date+):

                      Code
                      <div class="date">
                              <div class="month">[+createdon:date=`%b`+]</div>   
                              <div class="day">[+createdon:date=`%d`+]</div>
                              <div class="year">[+createdon:date=`%Y`+]</div>   
                            </div> 


                      You can then style the section as you like. You can view the final outcome here: http://jackmcdaniel.net

                      I styled the date to look like the rest of the site, but any thing is possible.

                      Thanks for all the help!
                        There are no boring projects. Only boring executions. ~ Etzkorn
                        www.impress-design.com