Forums / Setup & design / Obtaining full name of folder from $module_result.path
Lance Leger
Monday 09 August 2004 1:21:02 pm
I'm interested in returning the value from the name field of the folder class using $module_result.path. My section item.text returns only the short name field, which is what it's supposed to do. I believe what I need to do is use the fetch function referencing item.node_id, however, I've been unsuccessful getting this to work. My section consists of a $module_result.path loop and I want to pull values other than short name from each object in the array. What is the best practice to do this? Could you please provide example?
Bård Farstad
Tuesday 10 August 2004 2:28:45 am
To do this you can fetch the objects by id's and print the names. Below is an example which fetches an object with id 42 and displays it's name.
{let usr_obj=fetch( 'content', 'object', hash( 'object_id', 42 ) )} {$usr_obj.name} {/let}
--bård
Documentation: http://ez.no/doc
Tuesday 10 August 2004 7:07:11 am
In order for that to work, I have to supply the object ID. It is my understanding $module_result.path only supplies the node ID. So if I do a function as:
{section name=Header loop=$module_result.path|extract( 0, 2 )|reverse max=1} <span class="page_header_text"> {let usr_obj=fetch( 'content', 'object', hash( 'object_id', $Header:item.node_id ) )} {$usr_obj.name} {/let} {/span}{/section}
Perhaps this will work if I convert the node_id to object ID first, is there a function to do this?
Tuesday 10 August 2004 7:11:35 am
I think you can do it even simpler. Just use the node fetch function. E.g.:
{let usr_node=fetch( 'content', 'node', hash( 'node_id', 42 ) )} {$usr_node.name} {/let}
You can ask for the object title/name from both the node and the object. So this should give the same result.