Forums / Setup & design / What's wrong ? 70's

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

eZ debug

Timing: Jan 20 2025 19:26:00
Script start
Timing: Jan 20 2025 19:26:00
Module start 'content'
Timing: Jan 20 2025 19:26:00
Module end 'content'
Timing: Jan 20 2025 19:26:00
Script end

Main resources:

Total runtime0.1390 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.6094180.8438
Module start 'content' 0.00600.0071 768.4531101.9609
Module end 'content' 0.01310.1258 870.4141530.7813
Script end 0.1389  1,401.1953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.3798200.0002
Check MTime0.00130.9586200.0001
Mysql Total
Database connection0.00080.549010.0008
Mysqli_queries0.094167.74351410.0007
Looping result0.00110.81261390.0000
Template Total0.125490.210.1254
Template load0.00070.479210.0007
Template processing0.124789.745010.1247
Override
Cache load0.00050.333910.0005
Sytem overhead
Fetch class attribute can translate value0.00130.936110.0013
XML
Image XML parsing0.00020.172610.0002
General
dbfile0.00644.5724200.0003
String conversion0.00000.003630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs