Board Thread:Support Requests - Getting Technical/@comment-4189499-20130620114755/@comment-452-20130623191817

Imamadmad wants the date that a template is added to a page automatically listed in the template.

As far as I am aware, this is not possible to do with subst. I have attempted to do this with subst and not been able to and no-one has demonstrated how to do this with subst. It would also not work retroactively even if it did work.

I suggested a way to manually do it, but my suggestion would not work retroactively, and does not do it automatically, so I suggested a way to do it both automatically and retroactively.

Since the template he is asking about adds a category to the page, it is possible to use DPL's "addfirstcategorydate" to list when a page is first added to the category.

My working example solution to the problem:

This template is transcluded on User:452, adding "Category:Category 452 test" and doing a DPL query to get the date and time that that category was first added to the page.
 * User:452/Template:date_test

Where is your working example?

Also, I found the solution to the apostrophe problem

http://www.mediawiki.org/wiki/Help:Magic_words says: One simple way to fix this is wrapping the pagename in #titleparts.

I've done this in my example, and it's working fine here: User:452/452%27s_apostrophe_test

BTW Imamadmad, that template is protected, so we can't edit it.

If you would like to use what I have suggested, change this line: This page is a candidate for deletion{{#if:{{{1|}}}| because to this: This question was marked for deletion on {{#dpl:titlematch = {{#titleparts:{{PAGENAME}} }} | category=Candidates for deletion | addfirstcategorydate=true | userdateformat=Y-m-d H:i:s | format = ,%DATE%| skipthispage=false | dplcache=del | allowcachedresults=true }} {{#if:{{{1|}}}| because You can set userdateformat to whatever you want, see the DPL manual for details.