[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

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 09:41:46
Script start
Timing: Jan 19 2025 09:41:46
Module start 'layout'
Timing: Jan 19 2025 09:41:46
Module start 'content'
Timing: Jan 19 2025 09:41:47
Module end 'content'
Timing: Jan 19 2025 09:41:47
Script end

Main resources:

Total runtime0.8425 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 590.9063152.6406
Module start 'layout' 0.00650.0035 743.546939.4766
Module start 'content' 0.01000.8310 783.0234621.9453
Module end 'content' 0.84100.0015 1,404.968816.1250
Script end 0.8425  1,421.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4129160.0002
Check MTime0.00140.1626160.0001
Mysql Total
Database connection0.00070.083810.0007
Mysqli_queries0.775091.9906680.0114
Looping result0.00070.0882660.0000
Template Total0.805495.620.4027
Template load0.00200.238620.0010
Template processing0.803495.360020.4017
Template load and register function0.00010.014510.0001
states
state_id_array0.00110.130510.0011
state_identifier_array0.00250.295220.0012
Override
Cache load0.00170.2050390.0000
Sytem overhead
Fetch class attribute can translate value0.00060.067930.0002
Fetch class attribute name0.00090.108890.0001
XML
Image XML parsing0.00140.166130.0005
class_abstraction
Instantiating content class attribute0.00000.0023120.0000
General
dbfile0.00130.1597280.0000
String conversion0.00010.013940.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
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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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