[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.