Home
TeamSite
IW-Iterate
guitarist
My iterate loop in my tpl:
<iw_iterate list='dcr.news.Story.*' var='Story_Element'>
<iw_ifcase name='Story_Element'>
<div class="text"><iw_case type='para'>
<iw_value name='Story_Element'/><br><br>
</iw_case></div>
<div class="headline"><iw_case type='head'>
<iw_value name='Story_Element'/><br>
</iw_case></div>
<iw_case type='pic'>
<img src="{iw_value name='Story_Element'/}"/>
</iw_case>
</iw_ifcase>
</iw_iterate>
My container in my DCR:
<container name='story' location='story'>
<label>Story</label>
<container name='Story_Element' max='unbounded' combination='or'>
<label>Story_Element</label>
<item name='para' pathid='para'>
<label>Text</label>
<textarea required='t' wrap='virtual' cols='60' rows='8'/>
</item>
<item name='head' pathid='head'>
<label>Heading</label>
<text required='t' />
</item>
<item name='pic' pathid='pic'>
<label>Picture</label>
<browser ceiling-dir='/hr/images' initial-dir='/hr/images'/>
<browser extns='jpg,jpeg,gif' required='t' />
</item>
</container>
</container>
My question: I cannot seem to get the tpl to iterate at all. I have looked at all of the documentation and still cannot get it to work. I even tried the iterate example templates in my environment and cannot get those to iterate either. What am I doing wrong?
TeamSite 6.5 on Win.
Find more posts tagged with
Comments
Nicholas
Can you attach your DCT?
-- Nicholas
Lozza
Your container name is 'story'. Try changing the case of
dcr.news.Story.*
to
dcr.news.story.*
?
Loz
guitarist
here is the dct.
Nicholas
Two things:
1. You need to put all your HTML inside the CDATA block.
2. Change Story to story (as Lozza suggested).
Better if you read FormPublisher guide.
-- Nicholas
guitarist
How do you know that I haven't read the Forms Publisher guide?
2 things:
1. When people ask for help, snide comments are not helpful.
2. Do not assume that you know everything.
If I wanted a comedian I would've watched Comedy Central.
Nicholas
Because there even no CDATA block to separate your HTML and its very basic requirement to write any TPL. It was a suggestion after looking your code. And don't be emotional, I shouldn't have told that I know everything.
Adam Stoller
CDATA blocks are only necessary if you write strict-XML PTs - those that have a root <iw_pt>...</iw_pt> container blocks.
If you just use <iw_pt/> at the top (you can even omit it entirely I believe) you do not need any CDATA blocks - which makes it much easier to write the PT in my opinion. In fact, I prefer to write the entire PT in Perl.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Problem.rptdesign
Nicholas
Thanks Adam. This is something new that I didn't know and I favour to write entire PT in perl. Its makes code simple and easy to understand.
-- Nicholas
Adam Stoller
It's actually been possible to do this since 5.0.1 but didn't get much "exposure" until 5.5.1.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
sunsun
sorry. I dont want to be mean
But what you didnt know is also given in the documentation of forms publisher.
go to this link in your server and see the < iw_pt> documentation.
http://your_server_name/iw/help/tst/pt/TeamSite__PT__iw_pt.html
(the reference of this link is given in the documentation.
I also dislike when i ask some question on devnet and people tell me to look in the documentation. If people dont know any answers then only they post it up here.
Sorry again. If you felt i was rude.
cheers!!!!!!!!!