Forums / Setup & design / [solved] how to change the publication date ?

[solved] how to change the publication date ?

Author Message

Xavier Dutoit

Wednesday 14 September 2005 1:03:24 am

Hi,

The publication date is automatically calculated and that's fine for most of the cases. However, when importing older documents for instance, how can I change it to something else (the original date of publication) ?

X+

http://www.sydesy.com

Kristof Coomans

Wednesday 14 September 2005 2:33:44 am

If you import those documents with a script, you can set the published attribute of the content object to the original time.

$contentObject->setAttribute('published', $originalTime);

As far as I know, you can't do this in the web interface yet. So if you want to do it in the interface, you'll need to write a module or workflow event type.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Xavier Dutoit

Wednesday 14 September 2005 3:08:14 am

Hi,

That's what I thought.

Ok, I'm writing a module to add a /setdate/objectid/ tool.

Looking at the existing code, I've seen:

$contentObject->setAttribute( 'published', $published );
$contentObject->store( array( 'published' ) );

I've got a few tests to see what if I do that on a published object, otherwise, I'm going to run a sql query directly.

X+

http://www.sydesy.com

Xavier Dutoit

Wednesday 14 September 2005 9:42:38 am

Ok, it works, I had to add a few things to clear the cache but that's fine now.

I have added this feature to one of my private extensions, shouldn't be too long to create a separated one or add it to the kernel if one needs it.

X+

http://www.sydesy.com

laurent le cadet

Monday 19 September 2005 9:02:49 am

Hi,

In my case, I customized the standard article classes with adding a date attribute (default=empty).
In my full view template, I wrote this :

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

It works fine and it's easy to build.

Laurent

Xavier Dutoit

Monday 19 September 2005 9:11:16 am

Hi,

That's what I thought at the beginning, but then I needed to sort the articles based on this date. I didn't want to go through a custom fetch and wanted to use the standard sort features (eg. on the "what's new page"), that's why I needed to change the publication date.

Beside, as a matter of principle, I don't like when the system sets something and the admin can't change it.

http://www.sydesy.com

eZ debug

Timing: Jan 19 2025 23:41:31
Script start
Timing: Jan 19 2025 23:41:31
Module start 'content'
Timing: Jan 19 2025 23:41:32
Module end 'content'
Timing: Jan 19 2025 23:41:32
Script end

Main resources:

Total runtime0.7865 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 589.0859180.8125
Module start 'content' 0.00860.6664 769.8984627.0391
Module end 'content' 0.67500.1114 1,396.9375341.0547
Script end 0.7864  1,737.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4966210.0002
Check MTime0.00140.1825210.0001
Mysql Total
Database connection0.00130.166910.0013
Mysqli_queries0.705689.71492050.0034
Looping result0.00210.26552030.0000
Template Total0.755396.020.3777
Template load0.00200.260320.0010
Template processing0.753395.779320.3766
Template load and register function0.00010.010210.0001
states
state_id_array0.00100.126710.0010
state_identifier_array0.00110.143420.0006
Override
Cache load0.00180.2238390.0000
Sytem overhead
Fetch class attribute can translate value0.00110.145340.0003
Fetch class attribute name0.00120.147290.0001
XML
Image XML parsing0.00160.206340.0004
class_abstraction
Instantiating content class attribute0.00000.0030120.0000
General
dbfile0.00380.4854390.0001
String conversion0.00000.000830.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs