We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33027
    • 18 Posts
    Hi Everyone. I need some help please with showing Day tags in Ditto Calling. Basically i was ok with setting up date format for not show the createdon. So now when i use [+date+] it show day-month-year. However is there a way that i can show them seperately like

    [+day+]-[+month+]-[+year+]. reason behind it is i am trying to implement attached document here and on the summary page instead of having the difault time layout have my own style.
      • 33027
      • 18 Posts
      anyone??
        • 16278
        • 928 Posts
        It would help to see your complete Ditto call.
        You should be able to select the source of your date and the display format with the &dateSource and &dateFormat parameters. &dateFormat uses the same formats as the PHP strftime() (http://www.php.net/strftime) command, so for numerical months that will read:
        &dateFormat=`%d-%m-%y`

        laugh KP
          • 33027
          • 18 Posts
          [[Ditto? &startID=`2` &removeChunk=`Comments` &summarize=`20` &tpl=`news` &paginate=`1` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &tagData=`documentTags`]]
          

          and the News

            <h2 style="padding-top:10px;">[+title+]</h2>
            <span>Published on [+date+].</span>
            [+summary+]
            [+link+]
          
            • 16278
            • 928 Posts
            OK, now I’ve downloaded your sample, I see you need three dates, or rather the same date in three different formats. You can do that in the template, rather than using &dateSource, &dateFormat and [+date+]. Instead, you use PHx to modify the output of your placeholders.
            If your date is in a placeholder called myDate, this would mean a template something like:
            <h2 style="padding-top:10px;">[+title+]</h2>
            Published on 
            <div class="date">
            <div class="month">[+myDate:date=`%b`:ucase+]</div>
            <div class="day">[+myDate:date=`%d`+]</div>
            <div class="year">[+myDate:date=`%Y`+]</div>
            </div>
              [+summary+]
              [+link+]

            PHx is already built in to Ditto, so you don’t need to install the whole plugin. Details of its operation are at http://wiki.modxcms.com/index.php/PHx
            cool KP
              • 33027
              • 18 Posts
              many thanks for the reply. not sure what you mean by mydate. is this something i need to create? i would really appreciate your help on this.
                • 16278
                • 928 Posts
                I may have misunderstood rolleyes
                i was ok with setting up date format for not show the createdon
                myDate will be the placeholder for whatever field or template variable you want display as the date. Try it first with [tt]createdon[/tt], so the template reads:
                <h2 style="padding-top:10px;">[+title+]</h2>
                Published on 
                <div class="date">
                <div class="month">[+createdon:date=`%b`:ucase+]</div>
                <div class="day">[+createdon:date=`%d`+]</div>
                <div class="year">[+createdon:date=`%Y`+]</div>
                </div>
                  [+summary+]
                  [+link+]

                If you want to use a different date field, or you have created a template variable for your dates, put its name into the template in place of [tt]createdon[/tt]. The point is that the [tt][+date+][/tt] placeholder is no use to you, because it will only represent one date format, and you need three. smiley KP
                  • 33027
                  • 18 Posts
                  thank you so much for this. i promise i will put it as a add-on with as many templates as possible. so many thanks