Forum for discussing general topics related to Couch.
10 posts Page 1 of 1
I can get timestamps from k_page_date and k_page_modification_date, but these only give me when the page was created and when the page itself was edited.

What I'm trying to do is to put a timestamp on the page to tell visitors when the content was last updated. Unfortunately, looking around the database, it doesn't seem that there's anywhere that information gets stored.

Has anyone found a way to do this? Since there's no suitable column in the Couch tables, I'm guessing I'd need to trigger something when a page is saved so that it updates a timestamp in another table which I could then read. Though I haven't yet found if there's a way to trigger an action like that - I suspect not.
Would you want this date for only display purpose or would it also be used for, for example, sorting the pages according to it?

If sorting is needed, how about manually changing the publish date (k_page_date) when the content is updated? This is found in the 'advanced setting' dropdown.
If only display is required, you may define a type 'datetime' editable region and use it for the purpose.

Do let me know your thoughts on this.
Thanks for the suggestions.

They would work, but unfortunately I neglected one important word from my question. I'm really looking for a solution that would automatically update a datestamp on the page. Essentially, I don't want the user to have to worry about changing the datestamp manually. Because I know she'll forget <grin>.
@beermad, can you explain your experience with k_page_modification_date? Last time I checked this date gets updated in database after each pressing 'Save'. Why is this not what you need?
@trendoman: thanks, reading what you said made me dig a bit deeper to understand this.

k_page_modification_date does, as you say, reflect when the save button was clicked. But not for templated pages. I should really have tested what I was doing on a "normal" page to understand this better.

So for a "normal" page, k_page_modification_date has the desired effect. What's catching me out is that I have a set of pages built from a single clonable PHP file. But k_page_modification_date doesn't reflect when the individual cloned page was saved. Digging into the database tables, it appears that the modification_date column doesn't get updated when a page created from a template is saved (I'm not quite sure what that column's data represent as I can't tie it into a particular time anything was done). So at least that explains why it's not behaving as I expected.

I'm not sure if this represents a bug or is working that way for a reason.
I think something could be wrong with your installation..
See, I just checked for both single-page simple templates (that doesn't suppose to have cloned pages) and clonable templates (that have cloned pages). Clicking 'Save' updates the date on simple templates + existing cloned pages of clonable templates + creating new cloned pages in clonable templates.
@beermad, I second @trendoman's observation.

Instead of scrutinizing the database, why don't you please try putting something like the following in the *page-view* of your template to see more clearly if the date changes or not?
Code: Select all
<h2><cms:show k_page_modification_date /></h2>   
Thanks Trendoman and KK.

Putting <cms:show k_page_modification_date /> on the page was what I'd been doing. But I've realised now that I've been caught out by CouchCMS being clever and me being stupid.

I was hitting the save button to test the suggestions, but not actually changing any of the fields. And of course, Couch is intelligent enough to realise that if the new content is the same as the original, the page hasn't changed.

Now I've changed some content, the timestamp changes.

Thanks for your help and apologies by wasting your time being dim.
CouchCMS updates date on each 'Save' and doesn't compare content.. Therefore something is wrong..
trendoman wrote: CouchCMS updates date on each 'Save' and doesn't compare content.. Therefore something is wrong..

Probably with the way my brain's working at the moment...
10 posts Page 1 of 1

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 4 guests

cron