If I understand, you got the datetv working in the ditto listings and in the snippet tpl!
Now you need a to use the TV for the template of the document/resource itself!
Simple way: use pub_date or createdon instead of your own TV.
OR (not tested):
[[Ditto? &documents=`[*id*]` &save=`3` &dateSource=`yourTV`]]
[+date+]
The benefit of using pub_date or createdon is that you don’t have to set the TV every time
...and just use [*pub_date*] or [*createdon*] in the template.
Wow! You guys are quick.
@mrhaw
Considered using pub_date or createdon but wanted to simulate the ability to control display date for blog entries like you can with Wordpress - sometimes it is very beneficial. I didn’t realize Ditto could be self referential (like using something such as &documents=`[*id*], I thought it always had to be in the container page and aggregate subpages). So that way works because I can use a Ditto call in each blog entry and control the date format as before via Ditto.
@kp52
That way works too! In fact, this was originally what I was thinking when asking for help. Now I’m not sure which method would be better to use - your solution or mrhaw’s. Would one be more efficient or take less load time then the other? One being Ditto in the HTML template that refers to a chunk for formatting. The other being putting those necessary variables directly in the HTML template (pagetitle, author, date, etc) and using the DateFormat snippet to convert the date to something human readable.
I just want to make sure I’m not using a method that is extremely resource heavy unnecessarily.
Thanks guys!
There is
one more option
s:
To use the
Document Variable (pub_date or createdon) or yourTV and use
PHx plugin to format it:
<strong>[*pub_date:date=`%d-%b-%y %H:%M`*]</strong>
I haven’t really experienced any difference in load or speed from any of these methods.
Keith’s (kp52) custom snippet is about the same code as the PHx Plugin would run.
//The snippet #1 -
http://modxcms.com/forums/index.php/topic,18872.msg161906.html#msg161906