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)
Dire need of nested iteration ie
nico
Can someone please please post an example of how a nested iteration is coded in a tpl? The example in the interwoven book is not much help. I am in dire need of this asap.
thanks in advance,
Nico
Find more posts tagged with
Comments
Migrateduser
in datacatpure.cfg:
<item name="Faq">
<replicant max="100">
<description>
This template builds a list of Frequently Asked Questions
</description>
<item name="Question">
<textarea required="t" rows="10" cols="50" maxlength="200" wrap="physical" external-editor="visualformat" />
</item>
<item name="Answer">
<textarea required="t" rows="10" cols="50" maxlength="1000" wrap="physical" external-editor="visualformat" />
</item>
</replicant>
</item>
in faq.tpl:
<iw_iterate list="dcr.Faq" var="table" iteration="$linkcount">
<![CDATA[ <a name="#]]><iw_value name="$linkcount+1" /><![CDATA["></a><span class="bodyTextBold">]]><iw_value name="$linkcount+1" /><![CDATA[. ]]> <iw_perl>
<![CDATA[
$question = iwpt_dcr_value('table.Question');
$question =~ s/<p>//g;
$question =~ s/<\/p>//g;
]]></iw_perl><iw_value name="$question" /><![CDATA[</span>
<br>
<span class="bodyText">]]><iw_perl>
<![CDATA[
$answer = iwpt_dcr_value('table.Answer');
$answer =~ s/<p>//g;
$answer =~ s/<\/p>//g;
]]>
</iw_perl><iw_value name="$answer" /><![CDATA[ </span><br>
<div align="right"><a href="#top" class="linksBlue">back to the top</a></div>
<br>
]]>
</iw_iterate>
There is a little extra code in there to strip <p> and </p> tags out and to put incrumental #'s next to questions, but you can get the idea. Hope that helps.
nico
I don't see a neste iteration example there I see one iteration but not an iteration within an iteration. Also i'm not using perl but rather just html, can you post a more simple example?
Thanks so much,
Nico
brent1
Here is an example. I tried to strip out all of the Perl and extraneous stuff to make a simplified example.
In datacapture.cfg
**********************
<item name="Parts/Accessories">
<replicant min="0" max="60">
<item name="Parts">
<replicant min="0" default="1"
max="30">
<item name="Part Number">
<text size="30"
maxlength="20"/>
</item>
<item name="Short Description">
<textarea wrap="virtual"
rows="20"
cols="65"/>
</item>
<item name="Specifications Object">
<browser size="30"
initial-dir="Htdocs/products/partsandaccessories"/>
</item>
</replicant>
</item>
</replicant>
</item>
**********************
In .tpl
**********************
<iw_iterate list="dcr.Parts/Accessories" var="panda">
<iw_if expr="{iw_value name='panda.Parts.Part Number'}">
<iw_then>
<![CDATA[
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="22%" align="left"><b>Part No.</b></td>
<td width="78%"><b> Description</b></td>
</tr>
]]>
<iw_iterate list='panda.Parts' var='part'>
<![CDATA[
<tr>
<td width="22%" align="left" valign="top">{iw_value name='part.Part Number'/}
]]>
<iw_if expr="{iw_value name='part.Specifications Object'}">
<iw_then>
<![CDATA[
<br><a href="{iw_value name='part.Specifications Object'/}">specifications</a>
]]>
</iw_then>
</iw_if>
<![CDATA[
</td>
<td width="78%" valign="top">
{iw_value name='part.Short Description'/}
</td>
</tr>
]]>
</iw_iterate>
<![CDATA[
</table>
]]>
</iw_then>
</iw_if>
</iw_iterate>
**********************
Brent
Beckman Coulter Inc.
nico
I'll just paste in my code, what is wrong here?
Here is my dct code:
<item name="Product offerings">
<replicant max="4">
<item name="Sub Header Text">
<select required="t">
<option label="Products" value="Products"/>
<option label="Services" value="Services"/>
<option label="Customers" value="Customers"/>
<option label="Partners" value="Partners"/>
</select>
</item>
<item name="Body Text">
<description>150 character max</description>
<textarea required="t" cols="60" wrap="virtual" validation-regex="^[\s\S]{1,150}$" />
</item>
<item name="Sub Header Text 2">
<text maxlength="35"/>
</item>
<item name="Links">
<replicant max="10">
<item name="Link Text">
<text required="t"/>
</item>
<item name="Link URL">
<browser
required="t"
extns=".html"
initial-dir="/htdocs"
ceiling-dir="/htdocs"/>
</item>
</replicant>
</item>
</replicant>
</item>
Tpl code:
<!-- Begin Iteration -->
]]> <iw_iterate var='Productofferings' list='dcr.Product offerings'> <![CDATA[
<!-- Prod Offering Sub head -->
<span class="bold"><iw_value name='Productofferings.Sub Header Text'/></span>
<!-- Body Text -->
<p>
<iw_value name='Productofferings.Body Text'/>
</p>
<iw_value name='Productofferings.Sub Header Text 2'/> <br>
<!-- Begin nested iteration -->
]]> <iw_iterate var='Links' list='Productofferings.Links'> <![CDATA[
<span class="bracket">></span><a href="{iw_value name='Productofferings.Link URL'/}"><iw_value name='Productofferings.Link Text'/></a><br>
]]> </iw_iterate> <![CDATA[
<!-- End nested iteration -->
<br><br><br><br>
]]> </iw_iterate> <![CDATA[
<!-- End Iteration -->
brent1
Try changing
<span class="bracket">></span><a href="{iw_value name='Productofferings.Link URL'/}"><iw_value name='Productofferings.Link Text'/></a><br>
to
<span class="bracket">></span><a href="{iw_value name='
Links
.Link URL'/}"><iw_value name='
Links
.Link Text'/></a><br>
Brent
Beckman Coulter Inc.
nico
Ok guys (especially Brent) where do I mail the cigars?