Forums / Setup & design / Formatting the object name pattern

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.

eZ debug

Timing: Jan 31 2025 03:37:29
Script start
Timing: Jan 31 2025 03:37:29
Module start 'content'
Timing: Jan 31 2025 03:37:29
Module end 'content'
Timing: Jan 31 2025 03:37:29
Script end

Main resources:

Total runtime0.3247 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0097 587.9609370.2891
Module start 'content' 0.00970.0169 958.25001,005.6563
Module end 'content' 0.02660.2980 1,963.90633,894.9922
Script end 0.3247  5,858.8984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00491.4940200.0002
Check MTime0.00140.4339200.0001
Mysql Total
Database connection0.00200.605710.0020
Mysqli_queries0.209664.55231410.0015
Looping result0.00160.48291390.0000
Template Total0.297591.610.2975
Template load0.00130.397310.0013
Template processing0.296291.224810.2962
Override
Cache load0.00070.211210.0007
Sytem overhead
Fetch class attribute can translate value0.00240.750210.0024
XML
Image XML parsing0.00030.103510.0003
General
dbfile0.00852.6283200.0004
String conversion0.00000.002530.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs