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)
flexible presentation templates
tuzman
I am attempting to create a general page template for my site that will allow my users through the use of a generic DCR to create pages with one-to-many:
--headlines
--paragraphs
--bulleted lists
I have the DCR setup OK, but I am having trouble adapting the presentation templates to fix.
Basically, what expr can I use to determine whether or not the DCR field has a null value or not, and if it has a non-null value, print out the appropriate markup and data, and if the the DCR field is either not present or null, skip output of any markup and move on.
Hope I have made my issue clear. Thanks.
Find more posts tagged with
Comments
iwovGraduate
Have you looked at the documentation ?
I suggest you read the manuals and the example templates shipped with TeamSite. Also look at the TST FAQ - which is on the support site, as well as on your TS server.
You should be able to find numerous examples of what you are trying to do.
What version of TeamSite are you using ? Patch/SP level ?
Migrateduser
The documentation is pretty explicit about this stuff.
Dave
Current Environment(s):
(1) TS 6.1 SP2 on W2K3
(2) TS 6.1 SP2 on W2K
Adam Stoller
I suggest you post your DCT, perhaps a sample DCR, and what you currently have for your PT (with comments perhaps indicating the trouble areas) - so that people can respond using your existing code as a baseline.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
tuzman
DCR:
<blockquote>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data-capture-requirements SYSTEM "datacapture4.5.dtd">
<data-capture-requirements name="general" type="content">
<ruleset name="general">
<description>General Content</description>
<item name="meta-author">
<database data-type="VARCHAR2(255)" searchable="t" />
<label>(meta) Author Full Name</label>
<text required="t" size="60" maxlength="255" />
</item>
<item name="meta-creationDate">
<database data-type="DATE" data-format="yyyy-mm-dd" searchable="t" />
<label>(meta) Creation date</label>
<description>Date must be entered in YYYY-MM-DD format</description>
<text required="t" max-length="10" validation-regex="[0-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]" >
<inline command="/iw-home/httpd/iw-bin/getDefaultDate.ipl" />
</text>
</item>
<item name="breadcrumb">
<database data-type="VARCHAR2(255)" searchable="t" />
<label>Breadcrumb (refer to SiteMap.xml)</label>
<text required="f" size="60" maxlength="255" />
</item>
<item name="pagetitle">
<database data-type="VARCHAR2(255)" searchable="t" />
<label>Top Title of Page (Required)</label>
<text required="f" size="60" maxlength="255" />
</item>
<item name="dmain">
<replicant min="0" default="1" max="20">
<item name="heads">
<replicant min="0" default="1" max="1">
<item name="head">
<database data-type="VARCHAR2(40)" searchable="t" />
<label>Optional Headline</label>
<text required="f" size="60" maxlength="255" />
</item>
</replicant>
</item>
<item name="bodytext">
<replicant min="0" default="1" max="20">
<item name="bmain">
<database data-type="VARCHAR2(40)" searchable="t" />
<label>Main Body Paragraph Text</label>
<textarea cols="80" rows="10" external-editor="visualformat" external-editor-inline="f" wrap="virtual" required="f" />
</item>
</replicant>
</item>
<item name="bulletList">
<replicant min="0" default="1" max="20">
<item name="bulletItems">
<replicant min="0" default="1" max="20">
<item name="bulletItem">
<database data-type="VARCHAR2(40)" searchable="t" />
<label>Bullet Item</label>
<textarea cols="80" rows="10" external-editor="visualformat" external-editor-inline="f" wrap="virtual" required="f" />
</item>
</replicant>
</item>
</replicant>
</item>
</replicant>
</item>
<item name="tertiary">
<replicant min="0" default="0" max="30">
<item name="head">
<database data-type="VARCHAR2(40)" searchable="t" />
<label>Optional Headline</label>
<text required="f" size="60" maxlength="255" />
</item>
<item name="links">
<replicant min="0" default="1" max="20">
<item name="linktext">
<database data-type="VARCHAR2(15)" searchable="t" />
<label>Link Text</label>
<text size="60" maxlength="255" />
</item>
<item name="linkurl">
<database data-type="VARCHAR2(255)" searchable="t" />
<label>Insert Page</label>
<browser extns=".*" required="t" initial-dir="/" ceiling-dir="/" size="60" maxlength="255" />
</item>
</replicant>
</item>
</replicant>
</item>
</ruleset>
</data-capture-requirements>
</blockquote>
and the Presentation Template:
<blockquote>
<?xml version="1.0" encoding="UTF-8" ?>
<iw_pt name="main">
<![CDATA[<%
@taglib
uri='/WEB-INF/gartmore-funds.tld' prefix='gf'%>]]>
<![CDATA[<div id="col2">]]>
<gf:breadcrumb item="{iw_value name='dcr.breadcrumb'}" />
<div class="headSector"><b><iw_value name="dcr.pagetitle" /></b></div>
<![CDATA[<div id="greyRule3"><img src="/images/555555.gif" alt="" width="590" height="1" border="0" /></div>]]>
<![CDATA[<div id="col4fund">]]>
<iw_iterate list="dcr.dmain" var="page">
<![CDATA[<div class="campHeadTxt">]]>
<iw_iterate list="page.heads" var="h">
<iw_if expn='defined {iw_value name="h.head"}' >
<iw_value name="h.head" />
</iw_if>
</iw_iterate>
<![CDATA[</div>]]>
<![CDATA[<div id="campPara">]]>
<iw_iterate list="page.bodytext" var="bt">
<iw_if expn='defined {iw_value name="bt.bmain"}' >
<iw_value name="bt.bmain" /><p />
</iw_if>
</iw_iterate>
<![CDATA[</div>]]>
<![CDATA[<div id="campPara">]]>
<iw_iterate list="page.bulletList" var="bt">
<iw_if expn='defined {iw_value name="bt.bulletItems"}' >
<iw_iterate list="bt.bulletItems" var="bi">
<div id="belt"><img src="/images/bullet.gif" alt="" width="11" height="9" border="0" /></div><div id="campText"><iw_value name="bi.bulletItem" /></div>
</iw_iterate>
</iw_if>
</iw_iterate>
<![CDATA[</div>]]>
</iw_iterate>
<![CDATA[</div>]]>
<![CDATA[<div id="col5fund">]]>
<iw_iterate list="dcr.tertiary" var="tnav">
<![CDATA[<div id="module4a">]]>
<iw_if expn='defined {iw_value name="tnav.head"}' >
<div class="headSmall"><iw_value name="tnav.head" /></div>
</iw_if>
<iw_iterate list="tnav.links" var="ln">
<iw_if expn='defined {iw_value name="ln.linktext"}' >
<iw_if expn='defined {iw_value name="ln.linkurl"}' >
<div><div class="blueA"><![CDATA[•]]></div><div id="sideBlock"><a class="smallTxt" href="{iw_value name='ln.linkurl'}"><iw_value name="ln.linktext" /></a></div></div>
</iw_if>
</iw_if>
</iw_iterate>
<![CDATA[<p /></div>]]>
</iw_iterate>
<![CDATA[</div>]]>
<![CDATA[</div>]]>
</iw_pt>
</blockquote>
Adam Stoller
Well, you posted the DCT (not the DCR as labeled) and the PT (you should get rid of all those CDATA tags) - but without a sample of a DCR and the generated page indicating the problem you are seeing - it's difficult to know what to advise you of here.
You basically have a series of replicants (
head, bodytext, bulletList
[
bulletItems
]) within a containing replicant (
dmain
) - and then you have code like this in your PT:
<iw_iterate list="dcr.dmain" var="page">
<![CDATA[
<div class="campHeadTxt">
]]>
<iw_iterate list="page.heads" var="h">
<iw_if expn='defined {iw_value name="h.head"}' >
<iw_value name="h.head" />
</iw_if>
</iw_iterate>
<![CDATA[
</div>
]]>
...
If you do not have a
head
field (min=0) what shows up in the resultant generated page for the above section of code?
If you have a
head
field but it's left blank - what shows up in the resultant generated page for the above section of code?
(let's try to leave it at
just
the snippet of output as it relates to the above PT code and don't post the entire output file please.)
It could be that the solution is as simple as:
<iw_iterate list="dcr.dmain" var="page">
<iw_iterate list="page.heads" var="h">
<iw_if expn='{iw_value name="h.head"} ne ""' >
<div class="campHeadTxt"><iw_value name="h.head"/></div>
</iw_if>
</iw_iterate>
...
but that's just guessing right now.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com