This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » General » Display article create date

Display article create date

Display article create date

Friday 28 May 2010 5:35:34 pm - 8 replies

I'm not able to display article create date.
My class consist of the following attributes:

  • Name
  • Intro
  • body
  • image 

 I'm fetching the articles using the following code:

{def $complaints=fetch('content', 'list', hash('parent_node_id', 75, 'limit', 5))}
    {foreach $complaints as $complaint}
        <a href={$complaint.path_identification_string|ezurl}>{$|wash}</a> [{$complaint.data_map.published|l10n(date)}]

I'm able to list the names, but not the dates.

I've tried different variations:
{attribute_view_gui attribute=$complaint.data_map.date_attribute_id}
What am I missing?

Friday 28 May 2010 7:39:25 pm

You are missing the fact that the publication date is not an attribute of the object blunk.gif Emoticon

In short: every content object, as available in the templates, is made up of:

  1. its attributes, as defined in the content class
  2. some extra metadata

For 1, you access them using $obj.data_map, and you can use them with attribute_view_gui

For 2, you access them directly: $obj.published, $ etc...

Your best friend is the online doc: look at - for every member of $obj listed the datatype is clearly indicated

(note: the manual page is not very clear in that it uses the term "attribute" to denote two different things; we have the same problem for newcomers trying to distinguish a 'content object' from a 'template object')

Modified on Friday 28 May 2010 7:41:51 pm by Gaetano Giunta

Saturday 29 May 2010 8:13:50 am

And just in case you don't know:

{$complaint|attribute(show)} Will tell you a lot.. happy.gif Emoticon

Wednesday 02 June 2010 9:37:13 am

Thanks for the reply guys. But none of you made any sense really happy.gif Emoticon
(sorry, I'm noob )

I am assuming the folloing:

1. Articles (also knows as objects) has some system attributes. One being the creation date.

2. I do not need to create a date attribute for the class, since this is recorded automatically (one should never have to manually enter creation date of an article)

If you look at my example above, you will see that I am using 'attribute_view_gui' and 'data_map'.
I'm also using Håvards suggestions to output information about whatever object I have in my $complaint variable using

{$article|attribute(show, 1)}
{$article.data_map|attribute(show, 1)}

Can anyone give me an example of the code I need to use?

Modified on Wednesday 02 June 2010 9:37:50 am by Steven Stieng

Wednesday 02 June 2010 11:56:15 am

try {$complaint.object.published|datetime}

Wednesday 02 June 2010 12:13:00 pm

Oh, great! Thanks! Also using {$complaint.object|attribute(show, 1)} shows be all the attributes of the object. 

Now, can you tell me why the publish date is formatted like this?

1275052797, 1275052846, 1275052903

They don't really look like dates to me happy.gif Emoticon 

Wednesday 02 June 2010 1:03:42 pm

Unix time. That's what the datetime operator was for in the above example.

try {$complaint.object.published|datetime( 'custom', '%h:%i %a %d %F %Y' )}

Wednesday 02 June 2010 1:14:15 pm

I've never seen UNIX time before (as I can recall)
Thank you very much! 

Wednesday 05 January 2011 5:23:03 am


For published date of an article:


for all other date format click link below:

Thank you


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

36 542 Users on board!

Forums menu

Proudly Developed with from