Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
emit or omit value in generated file
JosephWalters
using TeamSite 5.5.2
What I am trying to do seems simple, but it has me stumped...
On the DCT,
If 'Display_Image' is marked as 'Yes'
Then, an image will be displayed with the content
If 'Display_Image' is marked as 'No'
Then, no image will be displayed with the content
Below are excerpts from my files.
In case you were wondering, the generated TPL is to a javascript file.
Any help/pointers would be great.
Many Thanks,
~Joseph
------------------------------------------
excerpt from TPL:
<iw_if expr=' ( {iw_value name="$singleElement" /}) ||
( {iw_value name="dcr.bottom_element.double.Display_Image" /} eq "Yes" )
'>
<iw_then>
<![CDATA[
document.write('<div class="story_last"> <img src="topDcr.indexcontent.small_photo" alt="placeholder" width="71" height="70" />');
document.write('<h4><a href="feature/{iw_value name="topDcr.file_administration.story_num"/}/index.html"><iw_value name="bottomSingle.indexcontent.headline" /></a></h4>');
document.write('<p><iw_value name="bottomSingle.indexcontent.description" /></p>');
document.write('</div>');
]]>
</iw_then>
<iw_else>
document.write('<div class="story2">');
document.write('<h4><a href="feature/{iw_value name="out1.file_administration.story_num"/}/index.html"><iw_value name="$headline_left" /></a></h4>');
document.write('<p><iw_value name="$description_left" /></p>');
document.write('</div>');
document.write('<div class="story_last">');
document.write('<h4><a href="feature/{iw_value name="out2.file_administration.story_num"/}/index.html"><iw_value name="$headline_right" /></a></h4>');
document.write('<p><iw_value name="$description_right" /></p>');
document.write('</div>');
</iw_else>
</iw_if>
excerpt from DCT:
<item name="Display_Image" colspan="2">
<description> Display Image </description>
<database data-type="CHAR(3)" />
<radio required="t">
<option selected="t" label="Yes" value="Yes" />
<option label="No" value="No" />
</radio>
</item>
excerpt from Parent DCT:
<item name="small_photo">
<label>Browse to Small Image </label>
<description>Appears with the headline and teaser text on the homepage.</description>
<browser
initial-dir='/directory'
cieling-dir='/directory' />
</item>
Find more posts tagged with
Comments
gzevin
from the first glance - you are missing CDATA after iw_else
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
JosephWalters
Thanks. My face is a nice shade of red now. lol
I added the CDATA, but still no success
Thanks,
~Joseph
----------------------------------------------------------------------
excerpt from TPL:
<iw_if expr=' ( {iw_value name="$singleElement" /}) ||
( {iw_value name="dcr.bottom_element.double.Display_Image" /} eq "Yes" )
'>
<iw_then>
<![CDATA[
document.write('<div class="story_last"> <img src="topDcr.indexcontent.small_photo" alt="placeholder" width="71" height="70" />');
document.write('<h4><a href="feature/{iw_value name="topDcr.file_administration.story_num"/}/index.html"><iw_value name="bottomSingle.indexcontent.headline" /></a></h4>');
document.write('<p><iw_value name="bottomSingle.indexcontent.description" /></p>');
document.write('</div>');
]]>
</iw_then>
<iw_else>
<![CDATA[
document.write('<div class="story2">');
document.write('<h4><a href="feature/{iw_value name="out1.file_administration.story_num"/}/index.html"><iw_value name="$headline_left" /></a></h4>');
document.write('<p><iw_value name="$description_left" /></p>');
document.write('</div>');
document.write('<div class="story_last">');
document.write('<h4><a href="feature/{iw_value name="out2.file_administration.story_num"/}/index.html"><iw_value name="$headline_right" /></a></h4>');
document.write('<p><iw_value name="$description_right" /></p>');
document.write('</div>');
]]>
</iw_else>
</iw_if>
gzevin
can you be more specific, as to what kind of error messages you are getting or what means 'success' to you in this case?
Putting everything aside, I'd start checking if your conditional statement is true - just try printing out some debigging messages, not the javascript code. Once you a clear, than you could add some more meat inside....
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
JosephWalters
Thanks for the tips.
Maybe I should have included this is my earlier post:
The stories are created from the parent DCT - a story is selected (i.e., variables passed as $headline_left, $description_left, etc.), and within those stories - 'small_photo' is what I would like the users to be able to either include the pre-specified image, or not, with the story.
excerpt from Parent DCT:
<item name="small_photo">
<label>Browse to Small Image </label>
<description>Appears with the headline and teaser text on the homepage.</description>
<browser
initial-dir='/directory'
cieling-dir='/directory' />
</item>
-------------------------------------------
So, if
{iw_value name="dcr.bottom_element.double.Display_Image" /} eq "Yes"
The below is outputted with an image. If false, it would exclude the image from the generated story:
document.write('<div class="story2">');
document.write('<h4><a href="feature/{iw_value name="out1.file_administration.story_num"/}/index.html"><iw_value name="$headline_left" /></a></h4>');
document.write('<p><iw_value name="$description_left" /></p>');
document.write('</div>');
document.write('<div class="story_last">');
document.write('<h4><a href="feature/{iw_value name="out2.file_administration.story_num"/}/index.html"><iw_value name="$headline_right" /></a></h4>');
document.write('<p><iw_value name="$description_right" /></p>');
document.write('</div>');
Any additional pointers would greatly be appreciated.
gzevin
I am afraid you are not painting a clear picture, and, from your snippets I cannot get anything that could help.
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU