We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27251
    • 1 Posts
    Hello all,

    I’m very new to Modx and am trying to get my head around customizing Ditto calls. I’m probably doing this all the wrong way but here goes...

    I have a Chunk with the following inside:
    <div id="ditto_item_[+id+]" class="ditto_item">
      <div class="NewBlog">
            <div class="NewCal">
              <div class="Month">
                 <h5>[+date+]</h5>
              </div>
              <div class="Day">
                <h6>[+date+]<h6/>
              </div>
      </div>  
    
         <div class="NewEntry">
                     <p3 class="ditto_pageTitle"><a href="[~[+id+]~]">[+pagetitle+]</a></p3>
                    <p class="space"> </p>
                    <div class="ditto_introText">[+introtext+]</div>
    
                    <br />
                  <a href="[+url+]">Read more...</a>
         </div>
    </div>
    



    I have followed this tut to try and make this work: http://ditto.modxcms.com/tutorials/sort-by-a-date-tv.html

    However I want to put ’%d’ in my <div class="Day"> inside my chunk and ’%m’ in <div class="Month"> using placeholders.

    Sorry if I’m not explaining myself well enough.

    My ditto call:
    [!Ditto? &parents=`2` &tpl=`HomeBlogTemplate` &summarize=`2` &paginate=`1` &paginateAlwaysShowLinks=`1` &sortBy=`myDate` &dateSource=`myDate` &dateFormat=`%d` !]



    I have also looked at using DittoCal but am struggling with that too...

    Please help!!
      • 16278
      • 928 Posts
      Ditto has only one [+date+] placeholder, which can only be fed by one &dateSource and &dateFormat parameter. All is not lost, however. Ditto also has a copy of the PHx (placeholders extended) plugin code, so you can manipulate a date fields more tha one way, or several fields, in your template chunk instead of using &dateSource etc.

      Like this:
      <div class="NewBlog">
              <div class="NewCal">
                <div class="Month">
                   <h5>[+myDate:date=`%m`+]</h5>
                </div>
                <div class="Day">
                  <h6>[+myDate:date=`%d`+]<h6/>
                </div>
        </div>  

      PHx basically lets you manipulate the strings output by placeholders in various ways. It’s described in the Wiki at http://wiki.modxcms.com/index.php/PHx.

      You’ll find examples of Ditto usage at http://www.pogwatch.com/ditto.html. It also has its own subforum near here.
      smiley KP