Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
dcr node name
meilee
Is it possible to check a dcr node name?
<item name="story">
<value>
<item name="image"> <- checik that the item has an "image" name
<value>image url</value>
</item>
</value>
<value>
<item name="description">
<value>
<item name="title">
<value>story title</value>
</item>
<item name="category">
<value>Organization</value>
</item>
<item name="summary">
<value>AHHHHHH.....</value>
</item>
<item name="description">
<value>description</value>
</item>
</value>
</item>
</value>
</item>
Find more posts tagged with
Comments
Lex
Check it from where?
Darryl Luther
darryl.luther@weyerhaeuser.com
Senior Web Analyst
Weyerhaeuser
meilee
check it from a tpl...
I understand that the value between <value></value> ina dcr is retrievable but how about the name in <item name="image"> node?
I wrote my tpl below to to extract my dcr. But i don't know how to go about checking the node name.
I hope the question makes sense. Thank you!
<star:main-body>
<iw_iterate var="story" list="dcr.story">
<iw_if expr="{iw_value name='story' /} eq 'description'"> <- This does not work
<iw_then>
<star:description>
<iw_value name="story"/>
</star:description>
<star:section>
<star:title><iw_value name="story.description.title"/></star:title>
<star:summary category="<iw_value name="story.description.category"/>">
<iw_value name="story.description.summary"/>
</star:summary>
<iw_value name="story.description.description"/>
</star:section>
</iw_then>
</iw_if>
</iw_iterate>
</star:main-body>
Lex
Ah, I see what you're saying, but I guess I don't understand why you would need to do this. I'm having difficulty understanding the problem this is attempting to solve. I've only ever used iw_iterate to loop through replicants, not through a diverse set of items as it appears you are doing. Sorry.
Darryl Luther
darryl.luther@weyerhaeuser.com
Senior Web Analyst
Weyerhaeuser
meilee
Thanks Darryl!
I don't think i am approaching the problem very well. I will have to find a better solution to do this.
THANKS!
LooseCannon
This is a fairly simple task to accomplish using one of many published Perl modules that manip XML.
Since most DCRs are saved in a specific format (item and value tag relationship) TeamSite is shipped with some that make XML manip even simpler.
The first module that comes to mind is TeamSite::XMLnode
Just perldoc the module and you'll get the necessary syntax
iwovGraduate
Maybe you want to tell a bit more about what you are trying to achieve ? In otherwords, some more details around why you need to know the node name and how you are planning to use it in a PT.
There maybe different ways to approach what you are trying to do.
meilee
I have this bit in the dct which gives the content contributor option to select a choice
<item name="mainList">
<description>Please select a description/image/customer's quote to add</description>
<label>Story Description</label>
<replicant combination="or" max="50">
<inline command="/bin/cat /iwmnt/default/main/
www.sun.com/web_site/en/service/WORKAREA/draft/templatedata/suncom/story/description.xml"/>
<inline command="/bin/cat /iwmnt/default/main/
www.sun.com/web_site/en/service/WORKAREA/draft/templatedata/suncom/story/image.xml"/>
<inline command="/bin/cat /iwmnt/default/main/
www.sun.com/web_site/en/service/WORKAREA/draft/templatedata/suncom/story/quote.xml"/>
</replicant>
</item>
and if the description and image is selected, the dcr is
<item name="mainList">
<value>
<item name="description"> <- Check this node name
<value>
<item name="title">
<value>meitest</value>
</item>
<item name="category">
<value>organization</value>
</item>
<item name="summary">
<value>retail business</value>
</item>
<item name="header">
<value>meitest</value>
</item>
<item name="description">
<value>very 5 million users description</value>
</item>
</value>
</item>
</value>
<value>
<item name="image"> <- Check this node name
<value>
<item name="title">
<value>meitest</value>
</item>
<item name="category">
<value>organization</value>
</item>
</value>
</item>
</value>
</item>
I would like to check the node name in the PT such that if it is a "description", it should render in one format and if it is an "image", it should render in another.
Thanks!! Any help will be great...
meilee
I think the question really is how to identify the different XML component if that makes any sense?
Adam Stoller
If you want to stick to XML-style PT's - I think you need to look at the documentation for things like iw_ifcase, iw_if/iw_then/iw_else.
If you want to go with a Perl-style PT - go with TeamSite::XMLnode and look at the type() function.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
meilee
Thanks!! I am having a bit of progress...
But i have a problem, I don't understand why it does not iterate through all the children in dcr.pageContent.mainList. THANKS!!
<iw_iterate var="node" list="dcr.pageContent.mainList.*">
Test
<iw_ifcase name="node">
<iw_case type="description">
<iw_perl><![CDATA[ $type='description';]]></iw_perl>
<iw_value name="$type"/>
<iw_value name="node.title"/>
</iw_case>
<iw_case type="image">
<iw_perl><![CDATA[ $type='image';]]></iw_perl>
<iw_value name="$type"/>
</iw_case>
</iw_ifcase>
</iw_iterate>
meilee
Thanks - I managed to figure it out...
<iw_iterate var="list" list="dcr.pageContent.mainList">
<iw_iterate var="node" list="list.*">
Test
<iw_ifcase name="node">
<iw_case type="description">
<iw_perl><![CDATA[ $type='description';]]></iw_perl>
<iw_value name="$type"/>
<iw_value name="node.title"/>
</iw_case>
<iw_case type="image">
<iw_perl><![CDATA[ $type='image';]]></iw_perl>
<iw_value name="$type"/>
</iw_case>
</iw_ifcase>
</iw_iterate>
</iw_iterate>