Hi all
Hoping somebody can help me understand, advise on the best/correct approcah and syntax to use for looping through and displaying results from DCRs. I already have my CFG setup and everything looks good in my capture form, though need help trying to understand and build my TPL files.
Small snippet of my .cfg
<data-capture-requirements type="content" name="articles">
<ruleset name="article">
<description>Article Data</description>
<inline command="/iw-home/iw-perl/bin/iwperl &navigationIncludeScript; Component_TFW" />
<!-- article container -->
<container name="article">
<label>Article details</label>
<!-- article title -->
<item name="article_title">
...
<!-- additional/optional items -->
<container name="additional_items" default="0" min="0" max='unbounded' combination="or">
<label>Additional Items</label>
<!-- text fields -->
<container name="text" label="Above">
<item name="text">
<label>Article text</label>
<description>The full description of the article.</description>
<textarea cols="80" rows="20" external-editor="tinymce"></textarea>
</item>
</container>
<!-- photo gallery/carousels -->
<container name="gallery">
<!-- image and caption work as a group -->
<container name="images" default="0" min="0" max='unbounded'>
<!-- image field -->
<item name="image" max='1'>
<label>Image</label>
<description>Images for carousel gallery [jpg]</description>
<browser initial-dir="/static/images/"
ceiling-dir="/static/" extns=".jpg,.jpeg"
size="50" maxlength="1000" />
</item>
<!-- image caption field -->
<item name="imagecaption" max='1'>
<label>Caption</label>
<description>Add a description for the photograph</description>
<text size="80" maxlength="200" />
</item>
</container>
</container>
...
My .tpl below with Pseudocode which is where I need the help.
<div class="article-container">
<h1><iw_value name='dcr.article.article_title'/></h1>
<div><iw_value name='dcr.article.article_body'/></div>
if [dcr.article.additional_items] has a value
loop through results
...
within this loop [additional_items] I have the items, which may or may not have a value:
[dcr.article.additional_items.text]
[dcr.article.additional_items.video]
[dcr.article.additional_items.quote]
I also have [dcr.article.additional_items.gallery], which has a few additional items itself,
another if else loop will be needed to loop through the images and captions:
if [dcr.article.additional_items.gallery.images] has a value
loop through results
...
[dcr.article.additional_items.gallery.images.image]
[dcr.article.additional_items.gallery.images.imagecaption]
else
show nothing
else
show nothing
</div>
Much apprciated for any gudeince, examples using iterator and how to get started.
Thanks,
Barry