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)
Read multiple dcr's
Gery
Hi,
I'd like to read multiple dcr's within .tpl file. I have 2 dcr's in a data folder (new1 and new2) and my .tpl file contains the following:
<iw_load_dcr var='new1' file='templatedata/q66a/home/data/new1'/>
<span class="titCajas"><iw_value name="new1.news.title"/></span><br>
<iw_value name="new1.news.body"/>
<iw_load_dcr var='new2' file='templatedata/q66a/home/data/new2'/>
<span class="titCajas"><iw_value name="new2.news.title"/></span><br>
<iw_value name="new2.news.body"/>
I don't know if I must load the 2 dcr's or typing an only one line of <iw_load_dcr> and getting new1 and new2 of other way (parameters)
How can I do it? Perhaps, I should use <iw_iterate> tag like this:
<iw_iterate list="dcr" var="x">
<span class="titCajas"><iw_value name="x.news.title"/></span><br>
<iw_value name="x.news.body"/>
</iw_iterate>
I have try it, but it doesn't work because only I can load the dcr which I preview. Any idea?
Thanks for the help
Find more posts tagged with
Comments
Adam Stoller
<iw_load_dcr var='new1' file='templatedata/q66a/home/data/new1'/>
<span class="titCajas"><iw_value name="new1.news.title"/></span><br>
<iw_value name="new1.news.body"/>
<iw_load_dcr var='new2' file='templatedata/q66a/home/data/new2'/>
<span class="titCajas"><iw_value name="new2.news.title"/></span><br>
<iw_value name="new2.news.body"/>
This looks right, assuming that the DCR "new1" contains a top-level element 'news' which contains 2nd-level elements 'title' and 'body' (and the same for the DCR 'new2'). Assuming that both these DCRs are in the same directory as the one that you initated the processing on (e.g. templatedata/q66a/home/data/first) you should be able to re-write the above as:
<iw_load_dcr var='new1' file='
new1
'
mode='dcrlocal'
/>
<span class="titCajas"><iw_value name="new1.news.title"/></span><br>
<iw_value name="new1.news.body"/>
<iw_load_dcr var='new2' file='
new2
'
mode='dcrlocal'
/>
<span class="titCajas"><iw_value name="new2.news.title"/></span><br>
<iw_value name="new2.news.body"/>
Are these "iwov" style DCRs or "xml" style DCRs? The former assumes something along the lines of:
<?xml ...>
<!DOCTYPE ...>
<record>
<item name="news">
<value>
<item name="title">
<value>...</value>
</item>
<item name="body">
<value>...</value>
</item>
</value>
</item>
</record>
The latter assumes something along the lines of:
<?xml ...>
<news>
<title>...</title>
<body>...</body>
</news>
The
iw_iterate
code you showed only makes sense if the
other
DCRs are referenced from within the first DCR (and even then, I think the code would need to be adjusted).
Does that help?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com