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

eZ debug

Timing: Jan 18 2025 15:50:56
Script start
Timing: Jan 18 2025 15:50:56
Module start 'content'
Timing: Jan 18 2025 15:50:56
Module end 'content'
Timing: Jan 18 2025 15:50:56
Script end

Main resources:

Total runtime0.1416 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.0063 587.8281180.8281
Module start 'content' 0.00630.0050 768.6563106.0234
Module end 'content' 0.01130.1303 874.6797534.0781
Script end 0.1416  1,408.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.2908200.0002
Check MTime0.00130.9067200.0001
Mysql Total
Database connection0.00060.422810.0006
Mysqli_queries0.100070.59271410.0007
Looping result0.00110.75691390.0000
Template Total0.130091.810.1300
Template load0.00070.521810.0007
Template processing0.129291.233110.1292
Override
Cache load0.00050.372010.0005
Sytem overhead
Fetch class attribute can translate value0.00080.557110.0008
XML
Image XML parsing0.00030.195410.0003
General
dbfile0.00191.3339200.0001
String conversion0.00000.005030.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