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)
Generating HTML files with iw_ostream
christinelewis
I have one template and I'm generating two HTMl files using the <iw_ostream> tag.
I have a snippet of perl at the top that is creating my variable that I am putting in the <iw_ostream> tag, this works fine. Setting the value of $linkPath to where I want the second HTML to be placed.
I then have the tags to generate the HTML, this, too, works fine.
<iw_ostream file_val='linkPath'>
<iw_iterate var='docs' list='dcr.standard.related_info.doc_attributes'>
<![CDATA[<div class="sidebarBody"><a href="<iw_value name='docs.related_doc.doc_path.value'/>">]]><iw_value name='docs.related_doc.doc_display.value'/><![CDATA[</div></a>]]>
</iw_iterate>
</iw_ostream>
Where I have my problem is I put the perl code at the top in an if statement so that the variable $linkPath will only be generated if there is data present in the template. After doing this the template would no longer generate. If I removed the <iw_ostream> code it was fine. I've played around and have no idea what I might be doing wrong.
If there is a better way to repress the creation of the HTML file, essentially not hitting the <iw_ostream> tag given certain critera, I would love to hear about it. My skills at PERL creation and creating conditional statments in the TPL are basic, so any advice would be appreciated.
Also, let me know if it's not clear. Thanks.
Find more posts tagged with
Comments
tsrookie
Hi Christine,
see if this helps,
wrap your iw_ostream stuff in an iw_if statement
<iw_if expr="{iw_value name='dcr.fieldName'/} ne '' ">
<iw_then>
<iw_ostream file_val='linkPath'>
<iw_iterate var='docs' list='dcr.standard.related_info.doc_attributes'>
<![CDATA[<div class="sidebarBody"><a href="<iw_value name='docs.related_doc.doc_path.value'/>">]]><iw_value name='docs.related_doc.doc_display.value'/><![CDATA[</div></a>]]>
</iw_iterate>
</iw_ostream>
</iw_then>
<iw_else>
</iw_else>
</iw_if>
Regards
Colin
christinelewis
Worked great, thanks!