Forums / Setup & design / Listing user country in staff directory

Listing user country in staff directory

Author Message

Ritu Sharma

Thursday 29 January 2009 10:41:58 am

Hi

I am trying to create a staff directory using user accounts in our Intranet. Though I am able to embed (while overriding /node/view/line.tpl) all as Text_line or text_block fields but I am not able to embed country and date of birth. I have used {$node.data_map.country.name|wash} but it gives me blank though the field has a value.

Please excuse me for a very new-bie question.

Regards

Greg McAvoy-Jensen

Thursday 29 January 2009 10:52:59 am

Ritu,

This is what I'm using:

{$node.object.data_map.country.content.value[$node.object.data_map.country.data_text].name}

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Ritu Sharma

Thursday 29 January 2009 11:07:41 am

Thanks Greg.

But this again gives me a blank line.

Ritu Sharma

Thursday 29 January 2009 11:13:43 am

Here is the code I am using:

<div class="content-view-line">
    <div class="class-user float-break">

    <h2><a href={$node.url_alias|ezurl}>{$node.data_map.first_name.content|wash} {$node.data_map.last_name.content|wash}</a></h2>
    {section show=$node.data_map.image.has_content}
        <div class="attribute-image">
            {attribute_view_gui image_class=articlethumbnail href=$node.url_alias|ezurl attribute=$node.data_map.image}
        </div>
    {/section}
    {$node.object.data_map.country.content.value[$node.object.data_map.country.data_text].name} 
    {$node.data_map.country.content.name.value} 
    {$node.data_map.add_work.content|wash}<br>
    {$node.data_map.country.content|wash}<br>
    $node.data_map.country.content: ({$node.data_map.user_country.content}) <br>
    $node.data_map.country.content|wash: ({$node.data_map.user_country.content|wash})<br>
    $node.data_map.country.name.content: ({$node.data_map.user_country.name.content})<br>
    $node.data_map.country.name.content|wash: ({$node.data_map.user_country.name.content|wash})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.name})<br>
    $node.data_map.country.name|wash: ({$node.data_map.user_country.name|wash})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.countryname})<br>
    $node.data_map.country.name|wash: ({$node.data_map.user_country.countryname|wash})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.content.value})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.content.value|wash})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.name.value})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.name.value|wash})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.name.content})<br>
    $node.data_map.country.name: ({$node.data_map.user_country.name.content|wash})<br>
    $node.data_map.country.value: ({$node.data_map.user_country.value})<br>
    $node.data_map.country.value|wash: ({$node.data_map.user_country.value|wash})<br>

    {section show=$node.data_map.intro.content.is_empty|not}
    <div class="attribute-short">
        {attribute_view_gui attribute=$node.data_map.intro}
    </div>
    {/section}

    </div>
</div>

You can see different options I've tried. What am I missing?

Regards

Greg McAvoy-Jensen

Thursday 29 January 2009 11:20:43 am

Two questions before we go farther.

1. Do you have debug output on so you can see what the system's complaint is?
2. Are you familiar with the technique for inspecting attributes, for example: {$node|attribute(show,1)}?

Try {$node.data_map.country.content.value[$node.data_map.country.data_text].name}.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Ritu Sharma

Thursday 29 January 2009 12:56:05 pm

Greg

I tried the debug system, it doesn't complaint anything.

Thanks for attribute filter. I used {$node.data_map.country|attribute(show,3)} and saw upto 3 levels. I could troubleshoot the problem to some extent but still stuck with it.

Now, I see the string value in data_text as 'CA' which indicates it should map to Canada. And if I try to display the country name using the direct array index CA, it works e.g. {$node.data_map.country.content.value[CA].Name}, works fine for those whose country is Canada (obviously). And {$node.data_map.country.data_text} displays CA correctly.

But {$node.object.data_map.country.content.value[$node.object.data_map.country.data_text].name} returns blank.

Is it because data_text is string? If so, can it be converted to the array index. (Not sure why getting a country name seems so comlicated.

Regards

Ritu

Greg McAvoy-Jensen

Friday 30 January 2009 9:50:32 am

Did you try what I posted in my last message: {$node.data_map.country.content.value[$node.data_map.country.data_text].name}?

As for the date question, have you tried attribute_view_gui (http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_functions/visualization)?

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Ritu Sharma

Monday 02 February 2009 2:31:27 pm

>>Did you try what I posted in my last message: >>{$node.data_map.country.content.value[$node.data_map.country.data_text].name}?

<b>I tried this but it didn't work either. It returns a blank line. I am using Ver 4.0. Could it be the changes in the structure of country datatype?</b>
The following worked for me:
{def $country=fetch( 'content', 'country_list', hash( 'filter', 'Alpha2', 'value', $node.object.data_map.country.data_text) )}
{$country.Name}

>>As for the date question, have you tried attribute_view_gui (http://ez.no/doc/ez_publish/techn...e/template_functions/visualization)?
No, I haven't tried that.
Again, the {$node.data_map.bday|attribute(show,2)} was very helpful and I used the following to display Birthday date:
Birthday (dd-mm): {$node.data_map.bday.content.day} - {$node.data_map.bday.content.month} ({$node.data_map.bday.content.zodiac_name})

I am still working on refining it to display month in words instead of number.

Thanks for all your help!!

Regards

Ritu