We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18817 ☆ A M B ☆
    • 205 Posts
    I have a getResource call on a page pulling in my child resources. I want to output the pubslishedon date, simple enough; so I thought. It seems to be auto-incrementing the date

    This is the getResource call on the page:
    <ul class="small-block-grid-1 medium-block-grid-3 large-block-grid-4 small-only-text-center js-filter-grid">
    [[!getResources?
        &tpl=`tpl_case_study_module`
        &includeTVs=`1` 
        &processTVs=`1`
        &tvPrefix=``
        &showHidden=`1`
        &limit=`0`
        &sortby=`{"publishedon":"DESC","createdon":"DESC"}`
    ]]
    </ul>


    This is the TPL chunk for the getResources call (removed a lot of code for readability)
    <li data-pub-date="[[+publishedon:strtotime:date=`%Y%m%d%H%M`]]" >
    	<img class="tooltip-img" src="[[+page_image]]" alt="[[+longtitle]]">
    	<h4>[[+menutitle]]</h4>
    	<p>[[+introtext:ellipsis=`75`]]</p>
    	<a class="link" href="[[~[[+id]]]]">View the Case Study</a>
    </li>


    trying to output the date in the data-pub-date attribute [ed. note: mayhemchaos last edited this post 11 years, 1 month ago.]
      Sal Baldovinos
      SEO & DIGITAL MARKETING

      ARIEL DIGITAL | Maximize Your Potential
      www.arieldigitalmarketing.com
      • 21739
      • 49 Posts
      1st) Are you sure those aren't the actual set publishedon times? You would be surprised how many times.....
      2nd) Try removing the outputmodifier 'strtotime', if that doesn't work, try this [[!+publishedon:strtotime:date=`%Y%m%d%H%M`]]
      3rd) Use pdoTools, near perfect drop-in replacement for getResources which is much, much faster. [ed. note: nondotzero last edited this post 11 years, 1 month ago.]
        • 3749
        • 24,544 Posts
        I think you're confusing strftime and strtotime. MODX gives you the dates as human-readable dates, but in order to format them, you need to convert them to timestamps with strtotime, then convert them back to human-readable form with strftime.

        See this: http://bobsguides.com/blog.html/2013/09/18/displaying-modx-date-fields/
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting