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)
loading dcr as is in TPL
conmgmt
How do I load dcr as is in a tpl ?
I have a container dcr which has references to other dcr as values.
For eg. the container dcr (container.dcr) is as follows....
<container>
<item name ="a">
<value>dcr1</value>
</item>
<item name ="b">
<value>dcr2</value>
</item>
</container>
I want to generate an html that will include the dcr1 and dcr2 in its entirety when I merge tpl with container.dcr.
Find more posts tagged with
Comments
Adam Stoller
When you say you want to include dcr1 and dcr2 in their entirety do you mean completely un-processed - as raw XML - or are you planning to process them with PT directives?
Also - do the fields that include dcr1 and dcr2 contain (a) full file-system paths, (b) full vpaths, (c) area-relative paths, or (d) just the filename itself?
For that matter, are all the DCRs of the same category/type, same category/different type, different category/type, different branch?
Last, but not least, what version of TeamSite / TeamSite templating are you using, on what [server] platform?
--fish
(Interwoven, Curriculum Development)
conmgmt
<<When you say you want to include dcr1 and dcr2 in their entirety do you mean completely un-processed - as raw XML - or are you planning to process them with PT directives?
>>
Answer --- yes, we want to include them as raw xml.
<<Also - do the fields that include dcr1 and dcr2 contain (a) full file-system paths, (b) full vpaths, (c) area-relative paths, or (d) just the filename
itself?>>
Answer --- just the file name.....but dcr1, dcr2 each belong to a different category/type. So in my tpl I can probably have the path put in before appending dcr1 and dcr2.
<<For that matter, are all the DCRs of the same category/type, same category/different type, different category/type,
different branch?>>
Answer --- The dcrs are different category/type
<<Last, but not least, what version of TeamSite / TeamSite templating are you using, on what [server]
platform?>>
Answer --- Teamsite v5.5.2 on Solaris
Adam Stoller
I think you could do what you want within an emedded iw_perl tag - i.e. if you have the path to the file in question, open it, and use iwpt_output() to spit it out. It might take a bit of trial-and-error to get it right as you may have to do some encoding/decoding to ensure that the XML tag delimeters '<>' stay as such and not get translated into '<' and '>' - but I think it should be fairly straight forward coding.
--fish
(Interwoven, Curriculum Development)
Migrateduser
DCRnode.pm is also helpful if you have any need to parse or even just serialize the DCR XML.
conmgmt
I am trying to do it this way....
<iw_perl><![CDATA[
$filename = iwpt_dcr_value('dcr.1');
]]>
<iw_include file='full-path/{iw_value name="$filename"/} '/>
</iw-perl>
I am not able to reference filename in <iw_include>. How can I reference it ?
Is there any issues with this approach ?
Adam Stoller
For one thing, if you're giving iw_include a full file-system path as a parameter, I think you need to specify mode="cwd"
I think you also may need to use 'file_val' and not 'file'
And, although I think the concatenation should probably work, if you're going to set a variable $filename - why not put the entire path in there?
my $filename = "full-path/" . iwpt_dcr_value('dcr.1');
Then, I think you can call iw_include like:
< iw_include file_val='$filename' mode='cwd'/>
You might, for debugging purposes, either stick a printout (iw_output) of $filename somewhere so that you can verify that it looks correct - or perhaps better yet, compile with iwpt_compile.ipl using the '-ocode' flag, and then run through the Perl debugger.
Hope that helps
--fish
(Interwoven, Curriculum Development)
conmgmt
<iw_include file_val='$full_filename' mode='cwd'/> didn't work. In this case the compile works fine, but the file does not get included in the ouput.
I tried doing it this way...
<iw_include file='$full_filename' mode='cwd'/> but I get the error on the compile
- Use of uninitialized value at (eval 13) line 78
Adam Stoller
Have you tried using iwpt_compile.ipl with '-ocode' and then walking through the resultant perl script with iwperl -d
tkdb scriptname ?
I'm sure it's something "real simple" - but it's very hard to diagnose unless you're walking through the actual scenario (and I'm not)
--fish
(Interwoven, Curriculum Development)