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.

eZ debug

Timing: Jan 18 2025 18:15:34
Script start
Timing: Jan 18 2025 18:15:34
Module start 'layout'
Timing: Jan 18 2025 18:15:34
Module start 'content'
Timing: Jan 18 2025 18:15:35
Module end 'content'
Timing: Jan 18 2025 18:15:35
Script end

Main resources:

Total runtime0.8817 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.1328152.6250
Module start 'layout' 0.00640.0030 741.757839.4453
Module start 'content' 0.00940.8706 781.2031548.6250
Module end 'content' 0.88000.0016 1,329.828112.1563
Script end 0.8816  1,341.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3621160.0002
Check MTime0.00130.1450160.0001
Mysql Total
Database connection0.00140.163510.0014
Mysqli_queries0.826693.7592600.0138
Looping result0.00050.0601580.0000
Template Total0.845395.920.4227
Template load0.00210.241620.0011
Template processing0.843295.635220.4216
Template load and register function0.00020.025210.0002
states
state_id_array0.00070.084510.0007
state_identifier_array0.00170.195920.0009
Override
Cache load0.00180.2076370.0000
Sytem overhead
Fetch class attribute can translate value0.00070.080220.0004
Fetch class attribute name0.00220.251450.0004
XML
Image XML parsing0.00060.063620.0003
class_abstraction
Instantiating content class attribute0.00000.001650.0000
General
dbfile0.00090.0967160.0001
String conversion0.00000.000740.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs