Forums / General / object name pattern issue

object name pattern issue

Author Message

Jon Arvid Ludviksen

Monday 13 October 2008 6:32:36 am

I've made a attribute nick and want the object name pattern for the user-class to be either nick or first_name and last_name.

<first_name> <last_name> works perfect.

<nick|first_name> works perfect but how do I add last_name?

Nabil Alimi

Monday 13 October 2008 1:24:14 pm

Hi Jon,

Have you tried <nick|first_name> <last_name> ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Jon Arvid Ludviksen

Tuesday 14 October 2008 12:28:18 am

Yes, I have. <last_name> shows no matter what.

Bård Farstad

Tuesday 14 October 2008 12:50:02 am

Hi Jon Arvid,

long time no see ;)

For the object name pattern you are not able to have a condition that shows either one (nick) or two (first + last name). You can only have one condition like your example.

So, to solve this you should use template code where you want to display the nick (if set) or the full name. The template code would look something like this:

{if $node.object.data_map.nick.content|eq("")}
    {attribute_view_gui attribute=$node.object.data_map.first_name}  {attribute_view_gui attribute=$node.object.data_map.last_name}
{else}
    {attribute_view_gui attribute=$node.object.data_map.nick} 
{/if}

You would then use this template code in wherever you want to show the users profile.

Hope this helps.

--bård

Documentation: http://ez.no/doc

André R.

Tuesday 14 October 2008 1:25:25 am

Bård is correct, but a slight tweak would be to use .has_content as it's more cross datatype safe:

{if $node.object.data_map.nick.has_content}
   {attribute_view_gui attribute=$node.object.data_map.nick} 
{else}
   {attribute_view_gui attribute=$node.object.data_map.first_name} {attribute_view_gui attribute=$node.object.data_map.last_name}
{/if}

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Jon Arvid Ludviksen

Tuesday 14 October 2008 1:36:17 am

Thanks Bård. Yes, it has been some time. And now I'm using eZ.. :-)

Too bad that it's not possible to have that condition. But no harm, <nick|first_name> will have to do. My curiosity led me to the question as I didn't want to use the template code to accomplish it.

And André, I would definitely use has_content. Not as messy as Bårds code. :-)

Bård Farstad

Tuesday 14 October 2008 6:16:29 am

Jon Arvid,

we also accept patches for improvements here :)

It would of course be possible to extend this syntax to something like:
<nick|first_name,last_name>
or
<nick|first_name:last_name>

Should not be that much work to modify this function.

-bård

Documentation: http://ez.no/doc

Piotrek Karaś

Thursday 16 October 2008 10:54:46 am

Hi guys,

Just would like to support the availability of more advanced syntax in the future versions of eZ. Object names are very useful especially for they are pre-fetched. We could definitely find some interesting uses for more complex pattern rules.

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

A Fowler

Wednesday 22 September 2010 1:00:35 pm

"

Hi guys,

Just would like to support the availability of more advanced syntax in the future versions of eZ. Object names are very useful especially for they are pre-fetched. We could definitely find some interesting uses for more complex pattern rules.

Cheers,
Piotrek

"

I second the request. We have the exact same situation, where we would like to allow the user to have a nick or pen name, but if they don't give one, it falls back to their first_name and last_name, which are two separate fields.

Is this supported yet in eZ Publish? It's 2010 now...

Thanks!

A Fowler

Wednesday 22 September 2010 1:42:11 pm

"
"

Hi guys,

Just would like to support the availability of more advanced syntax in the future versions of eZ. Object names are very useful especially for they are pre-fetched. We could definitely find some interesting uses for more complex pattern rules.

Cheers,
Piotrek

"

I second the request. We have the exact same situation, where we would like to allow the user to have a nick or pen name, but if they don't give one, it falls back to their first_name and last_name, which are two separate fields.

Is this supported yet in eZ Publish? It's 2010 now...

Thanks!

"

According to http://issues.ez.no/6908, it seems to have been solved, and the syntax is as follows: <nickname|(<firstname> <lastname>)>. I'm about to test it.

eZ debug

Timing: Jan 17 2025 23:53:54
Script start
Timing: Jan 17 2025 23:53:54
Module start 'content'
Timing: Jan 17 2025 23:53:54
Module end 'content'
Timing: Jan 17 2025 23:53:54
Script end

Main resources:

Total runtime0.1507 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.8203180.8438
Module start 'content' 0.00680.0070 769.6641110.4766
Module end 'content' 0.01380.1368 880.1406537.8984
Script end 0.1506  1,418.0391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.3477200.0002
Check MTime0.00140.9203200.0001
Mysql Total
Database connection0.00090.576810.0009
Mysqli_queries0.103168.42011410.0007
Looping result0.00120.77731390.0000
Template Total0.136490.610.1364
Template load0.00090.568710.0009
Template processing0.135689.985110.1356
Override
Cache load0.00070.431510.0007
Sytem overhead
Fetch class attribute can translate value0.00070.478510.0007
XML
Image XML parsing0.00040.235610.0004
General
dbfile0.00775.0821200.0004
String conversion0.00000.006630.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.0001 secs