We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4429
    • 429 Posts
    Hi,
    I have a very simple question, but a search has not helped solve it.

    Basically I want to know how I can call the published date of a document. I have tries [+date+] but that calls the actual date.

    The reason I am asking is that I have a back dated blog entry 5/6/09 that I now want to make live, but I want the date to show it as being published to the user on 5/6/09
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Then you don’t want the pub_date, which will be the date you actually publish the document. You want the create_date.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 4429
        • 429 Posts
        Quote from: sottwell at Jun 28, 2009, 11:39 AM

        Then you don’t want the pub_date, which will be the date you actually publish the document. You want the create_date.

        no, the document was created today, but i want to make it look as though it was created on 5th June.

        Basically its for a test blog about my motorcycle trip around Europe. I wrote the blog while travelling but didn’t put the stories into modx
          • 3749
          • 24,544 Posts
          You could just create a date template variable and show that. You could put whatever you want in it. I think you could set the default value to the published or created date but I’ve never tried it.
            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
            • 7231
            • 4,205 Posts
            To change the source for the [+date+] placeholder you need to use the &dateSource parameter in the call. To use pub_date set it like &dateSource=`pub_date`.

            Note that Ditto will use another date source if there is no pub_date for the document (not sure the hierarchy, but I think it goes to publishedon). If you want to limit it to only using pub_date, then use the [+pub_date+] placeholder and format it either with PHx [+pub_date:date=`%d.%m.%Y`+] or using the dateTime (or other) snippet.

            PHx is available to use within Ditto TPLs natively, no need to install PHx to use it in Ditto.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 4429
              • 429 Posts
              Quote from: dev_cw at Jun 29, 2009, 05:34 AM

              To change the source for the [+date+] placeholder you need to use the &dateSource parameter in the call. To use pub_date set it like &dateSource=`pub_date`.

              Note that Ditto will use another date source if there is no pub_date for the document (not sure the hierarchy, but I think it goes to publishedon). If you want to limit it to only using pub_date, then use the [+pub_date+] placeholder and format it either with PHx [+pub_date:date=`%d.%m.%Y`+] or using the dateTime (or other) snippet.

              PHx is available to use within Ditto TPLs natively, no need to install PHx to use it in Ditto.

              &dateSource=`pub_date` was exactly what I wanted. Many thanks