What's wrong ? 70's

Author Message

laurent le cadet

Thursday 21 April 2005 1:19:45 am

Hi,

I added a empty datefield to the article class to allowed users to change the publication date.
In article.tpl I wrote this :

{section show=$node.object.data_map.date_de_publication.content.is_empty|not()}
{$node.object.data_map.date_de_publication.data_int|datetime(custom,"%F %Y")}
{section-else}
{$node.object.published|datetime(custom,"%F %Y")}
{/section}

So if users leave it blank we use the publication's date.

but this :

{$node.object.published|datetime(custom,"%F %Y")}

nested in {section-else} print January 1970.

When this part of the code is out of the section block I have the good date.

Any hint ?

Laurent

Łukasz Serwatka

Tuesday 26 April 2005 6:45:20 am

Hi Laurent,

Try with

{$node.object.published|datetime('custom', '%F %Y')}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

laurent le cadet

Tuesday 26 April 2005 7:00:02 am

Hi Lukasz,

january 1970 :(
It seems to be simple but I have no idea about that.

Łukasz Serwatka

Tuesday 26 April 2005 7:04:52 am

Try without section, just for current node

{$node.object.published|datetime('custom', '%F %Y')}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Hans Melis

Tuesday 26 April 2005 7:06:23 am

Let's try to locate the error first.

What is printed when you only do {$node.object.published} in the section-else?

If it doesn't print 0, the error is in the datetime operator. But my wild guess is that it will print 0.

Hans
http://blog.hansmelis.be

laurent le cadet

Tuesday 26 April 2005 7:22:59 am

I tryed both of your hints :

{section show=$node.object.data_map.date_de_publication.content.is_empty|not()}
- {$node.object.data_map.date_de_publication.data_int|datetime(custom,"%F %Y")}
{section-else}
- {$node.object.published}
{/section}
{$node.object.published|datetime('custom',"%F %Y")}

{$node.object.published} = january 1970
{$node.object.published|datetime('custom',"%F %Y")}= august 2002

laurent le cadet

Monday 16 May 2005 12:37:15 am

Solved

I removed the attribute "date_de_pubication" and create a new one (empty by default) and it's ok.

I think the mistake (bug ?) was that when I created it first I made it with "today's date" by default and then changed to leave it empty.
The first choice seems to take advantage on the second.

Here's the code if it can help someone :

{section show=$node.object.data_map.date_de_publication.has_content}
{$node.object.data_map.date_de_publication.data_int|datetime(custom,"%F %Y")}
{section-else}
{$node.object.published|datetime('custom',"%F %Y")}
{/section}

Laurent

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 07:09:10
Script start
Timing: Jan 19 2025 07:09:10
Module start 'layout'
Timing: Jan 19 2025 07:09:10
Module start 'content'
Timing: Jan 19 2025 07:09:12
Module end 'content'
Timing: Jan 19 2025 07:09:12
Script end

Main resources:

Total runtime1.7779 sec
Peak memory usage4,096.0000 KB
Database Queries71

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0084 589.0547152.6094
Module start 'layout' 0.00840.0050 741.664139.4141
Module start 'content' 0.01341.7629 781.0781640.3359
Module end 'content' 1.77630.0015 1,421.414116.1875
Script end 1.7778  1,437.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.2277160.0003
Check MTime0.00160.0921160.0001
Mysql Total
Database connection0.00110.061610.0011
Mysqli_queries1.692495.1901710.0238
Looping result0.00110.0611690.0000
Template Total1.726897.120.8634
Template load0.00260.144020.0013
Template processing1.724396.984020.8621
Template load and register function0.00010.007110.0001
states
state_id_array0.00270.151110.0027
state_identifier_array0.00190.108320.0010
Override
Cache load0.00220.1264490.0000
Sytem overhead
Fetch class attribute can translate value0.00100.056130.0003
Fetch class attribute name0.00180.0996100.0002
XML
Image XML parsing0.00160.091530.0005
class_abstraction
Instantiating content class attribute0.00000.0020140.0000
General
dbfile0.00140.0765290.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs