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)
using one .tpl across multiple data_types
conmgmt
I have a category with multiple data_types. Each data_type has a datacapture.cfg and multiple dcrs.
Is it possible to create a presentation template which refers to above dcrs from different data_types ?
Find more posts tagged with
Comments
Adam Stoller
Are you asking if you can share a single PT for multiple data types - or whether you can reference DCR from one data type from within a PT for another data type?
The first case used to be (and may still be) possible on Unix with symbolic links - though you'd still have to list it within the templating.cfg file. Another possibility is to store the "meat" of the PT somewhere more "general" and use the include directive (see
http://servername/iw/help/tst/pt/TeamSite__PT__iw_include.html
for details)
For the latter case - I think you'd need to use the iwpt_load_dcr() routine - see
http://servername/iw/help/tst/pt/TeamSite__PT__iw_perl.html
for more details)
--fish
(Interwoven, Curriculum Development)
conmgmt
I am referring to the first case.... ie. sharing a single PT for multiple data types..
Another related question was....If the item name gets repeated in 2 dcrs how can I distinguish it in my tpl ? For eg. if 1.dcr and 2.dcr have item names "Title" how can refer to both titles in the tpl ?
Adam Stoller
Based on the first answer - it shouldn't matter - because you would refer to the title element through the dcr object 'dcr.title' (or similar) - as long as the structure is the same in both DCR's it doesn't matter which dcr is being looked at.
Based on the second answer - you would provide a unique symbolic name for each additional DCR you load and reference it accordingly (e.g. 'dcr.title', 'dcr2.title', 'another_dcr.title', etc.)
--fish
(Interwoven, Curriculum Development)
conmgmt
I am able to create a single PT for multiple data types using <iw_load_dcr> in the tpl.
The tpl is placed in a general folder and it loads the required dcrs using <iw_load_dcr>.
so the tpl looks like this.....
<iw_pt name="a">
<iw_load_dcr var='m' file='image1' mode='docroot' global='t'/>
<iw_value name='m.Title'/>
<iw_load_dcr var='n' file='document1' mode='docroot' global='t'/>
<iw_value name='n.Title'/>
<iw_value name='n.Author'/>
</iw_pt>
I am able to create an html file using
iwpt_compile.ipl -pt a.tpl -ofile a.html
from the command line. I am not specifying any dcrs as the tpl will know which dcrs to load. In the above eg. its image1.dcr and document1.dcr
We are assuming that a given tpl can have only specific datatypes. For eg. lets say we have a tpl which can contain references to one or more images and one or more document names.
I have the following questions ....
1. Do you see any issues with this approach?
2. Can we achieve html generation using UI rather than command line compile ?
3. To make the tpl more generic, can we pass dcrs as user input (from UI) and then make the tpl call <iw_load_dcr> to load the user inputted dcr ?
4. How can we dynamically change the call to <iw_load_dcr> in tpl based on the no. of images or document dcrs passed from UI?
Adam Stoller
> 1. Do you see any issues with this approach?
I think you've seen the issues yourself - as evidenced by the other questions. There may be more issues but I'm not sure (and don't really have the time right now to try and figure it out)
> 2. Can we achieve html generation using UI rather than command line compile ?
The UI uses 'iwgen' and that command requires a path to a DCR (one and only one). In order to achieve what you want here, you would have to create a custom menu item / custom CGI script to prompt for the relevant information and to run iwpt_compile.ipl - and *then* to use iwextattr to set the extended attributes on the generated file.
> 3. To make the tpl more generic, can we pass dcrs as user input (from UI) and then make the tpl call <iw_load_dcr> to load the user inputted dcr ?
Well - perhaps you could make one DCR that takes references to other DCRs - and then you might be able to use the GUI - because you could have the "master" PT look for DCR references and then load them dynamically. This might achieve the desired behavior for (2) and (3).
> 4. How can we dynamically change the call to <iw_load_dcr> in tpl based on the no. of images or document dcrs passed from UI?
See answer to (3) - I believe it is possible.
--fish
(Interwoven, Curriculum Development)