This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » "Article published by and last...

"Article published by and last updated by"-snippet

"Article published by and last updated by"-snippet

Tuesday 11 November 2003 12:21:49 pm - 2 replies

At the end of every article of my site I'd like to show some information about when the article was published and by whom. Also, if the article is updated I'd like to show the same information for the last update.

I haven't spent to much time on this, and as I'm sure somebody already must have faced and probably solved this situation, I hoping for some solutions here on the forum.

This is my pesudocode; of course it doesn't work properly. It needs a section show to hide the "last updated"-part if the article hasn't been updated.

{default content_object=$node.object}

<p class="byline">

By: {$}, {$content_object.published|l10n( datetime )}

<section show=(if altered=true)>
<br />Modified by: {$},{$content_object.modified|l10n(datetime)}


It's important that changes made by a second editor user doesn't overwrite the original creators name after "Published by", but is placed after "Modified by:".

Yup, any suggestions is much appreciated.
Regards, Valentin.

By the way; I posted this related topic earlier this year:

Modified on Tuesday 11 November 2003 12:26:25 pm by Valentin Svelland

Tuesday 11 November 2003 3:00:20 pm

Hello Valentin,

This code should work, but I haven;t test it. Check the comments for explanation

{default content_object=$node.object //original article
content_version=$node.contentobject_version_object} //latest version of article

<p class="byline">

Posted By: {$|wash}, //show owner of the original article
{$content_object.published|l10n(datetime)} //show datetime of original article

{section name=modified show=and($content_object.is_published|not(), $content_version|eq(1)} //check if original is not_published (value: "0"blunk.gif Emoticon and if the status of the latest version is "1", if both are true show section

<br />Modified by: {$} //name of creator of the latest version, {$content_version.modified|l10n(datetime)} //datetime of the latest version


I don't know if checking for the published value of the original is enough, that's why I'm checking for the status of the latest version too (I think value "1" means everything is fine, and that it is published)

Good luck,

Modified on Tuesday 11 November 2003 3:03:46 pm by Shurbann Martes

Thursday 13 November 2003 10:09:18 am

Thanks shurbann, your reply was very useful. I've tested it out, made some small changes - and yes - it works!!

Everyone, feel free to use this snippet:

{default content_object=$node.object

<p class="byline">

Published by: {$|wash}, {$content_object.published|l10n(datetime)}

{section name=modified show=and($content_object.is_published|not(), $node.contentobject_version_object.version|gt(1))}

<br />Last modified by: {$}, {$content_version.modified|l10n(datetime)}



Good luck! happy.gif Emoticon

Modified on Thursday 13 November 2003 10:10:03 am by Valentin Svelland


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from