This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » object name pattern issue
expandshrink

object name pattern issue

object name pattern issue

Monday 13 October 2008 3:32:36 pm - 9 replies

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?

Monday 13 October 2008 10:24:14 pm

Hi Jon,

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

Tuesday 14 October 2008 9:28:18 am

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

Tuesday 14 October 2008 9:50:02 am

Hi Jon Arvid,

long time no see blunk.gif Emoticon

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

Tuesday 14 October 2008 10: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}

Tuesday 14 October 2008 10:36:17 am

Thanks Bård. Yes, it has been some time. And now I'm using eZ.. happy.gif Emoticon

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. happy.gif Emoticon

Tuesday 14 October 2008 3:16:29 pm

Jon Arvid,

we also accept patches for improvements here happy.gif Emoticon

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

Thursday 16 October 2008 7:54:46 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

Wednesday 22 September 2010 10: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!

Wednesday 22 September 2010 10: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>blunk.gif Emoticon>. I'm about to test it.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from