Formatting the object name pattern

Author Message

Martin B

Tuesday 28 November 2006 9:03:19 am

I've just created a content class for an on-line version of a magazine (it's called Link, that's what I will call it in this post).

Link appears every two months and I'd like the title to be 'Link Octobre 2006', for example.

The content class contains a 'date' attribute, and I'd like to use that for the name pattern because I'd like the node name to be automatically translated (our site runs in 3 languages).

The object name pattern looks like this:

Link <date>

The name then gets expanded to:

Link Monday 20 November 2006

However, I'd like it to be

Link November 2006

Is there a way of doing this automatically? Or do I have to use a text-line for the date where our editors put in 'November 2006' (which would be rather uncool :)

What I'm looking for is a way to be more specific about the name pattern, perhaps something like this:

Link <date:formatoptions> or
Link <date.month|date.year>

or whatever. Preferably a solution that doesn't imply writing code.

Thanks in advance.

Kristian Hole

Tuesday 28 November 2006 9:37:59 am

Unfortunately this is not possible without changing the kernel.

The name is set in:

kernel/classes/ezcontentclass.php

in the functions:

contentObjectName()
buildContentObjectName()

For the datetime-datatype it comes from:

classes/datatypes/ezdatetime/ezdatetimetype.php
and the function

title()

Which actually sets the date formatted according to your locale. But changing how the locale shows the date will change it on your entire site. Unfortunately. Please add an enhancement report in the bugtracker.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Martin B

Wednesday 29 November 2006 4:00:30 am

Does that ONLY affect the name dates get parsed in the title creation? If so, I think I can live with that. Dates are rarely part of title anyway.

I will write a kernel override and post it here - thanks for the help and the precise directions.

Martin B

Wednesday 29 November 2006 9:35:47 am

I just noticed: When I switch to another language, the title is still the same. Doesn't the title get automatically translated? Of course I want my title to be different for every translation. That doesn't seem to work, though.

I've tried clearing the cache.

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