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)
How to add entire DCR under a tag in TPL
sabih
I need to embed the entire dcr under a custom tag in the .tpl file. Any help would be appreciated.
DCR:
<?xml version="1.0" encoding="UTF-8"?>
<page>
<Content>sss</Content>
<Page_Heading>sadas</Page_Heading>
<a>
<Page_Title>saaa</Page_Title>
</a>
</page>
TPL:
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="page">
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
]]>
<mymain>
<mytitle><iw_value name="dcr.page.a.Page_Title"/></mytitle>
<myheading><iw_value name="dcr.page.Page_Heading"/></myheading>
<mycontent>---ENTIRE DCR HERE ---</mycontent>
</mymain>
</iw_pt>
Find more posts tagged with
Comments
nipper
Not horribly difficult. You will need a perl callout to read the DCR in its entirity into a variable
and return that. I assume there is an environment variable or starting parameter where you can grab
the DCR name. Once you have that, this is easy.
ANdy
gzevin
nipper,
why callout? RTFM on how to get a DCR name from within a TPL will definitely help
then, this DCR could be just read into a string... well, you do know the drill, don't you?
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
nipper
I figured it was not too tough, I just did not know off hand, so I answered as best I could. Iwas was almost 3 pm
on Friday, lucky I was sober enough to answer that much.
me
sabih
I tried to follow the steps but somehow keep getting an error of "could not process template".
$dcrfilename = iwpt_get_dcr_name("basename");
open(DAT, $dcrfilename) || die("Could not open DCR!");
@raw_data=<
;DAT>;
close(DAT);
iwpt_output(
@raw_data)
;
Any help would be appreciated.
nipper
When you do the die, print out $dcrfilename
May not have iw-mount or something like that.
sabih
The DCR file name appears fine just before the OPEN command. The error occurs at the time of trying to open the file.
Migrateduser
Give us an example of what it returns. I'm with Andy, on this. I think that you are getting the path from the workarea, not the entire path all the way from iw-mount.
sabih
It just returns the name of the DCR "test". I am adding the following path to it with and without .dcr extension.
$filename = iwpt_get_dcr_name("basename").".dcr";
$complete_path = "/ICT/main/Agent_Website/WORKAREA/Interactive_Marketing/templatedata/CTAs/Brand_CTA/data/";
$dcrfilename = $complete_path.$filename;
iwpt_output($dcrfilename);
Use TeamSite::XMLparser;
open(DCR, "$dcrfilename") or die("$! Cannot open DCR");
local $/=undef;
my $xml = <DCR>;
close DCR;
my $parser = TeamSite::XMLparser->new();
my $rootnode = $parser->parse($xml);
my $myval=$rootnode->value("Content");
Migrateduser
There shouldn't be a .dcr extension on your DCRs. Even if you had put one, that would be in the valure returned by iwpt_get_dcr_name().
I'm very suspicious of the value you have in complete_path. I can buy that you have an archive named "ICT", but that path looks like you have it mounted right at root, which I don't believe.
What does iwgetmount return when you run it at the command line?
Also, let's see the output of iwstoreadm -l just to confirm that you really did name your archive ICT.
Migrateduser
Also, Greg caught this in the other thread - somehow I overlooked it.
You have
Use
rather than
use
.