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)
output empty
getnaren
I am trying to generate rss output using the dcrs in data folder. I get blank page and nothing in it.
here is the attached tpl.
Find more posts tagged with
Comments
Adam Stoller
Are you getting
nothing
, or just not getting the data from the DCRs you are trying to read and process?
If the latter (or in any case), here are some modifications that might be of use:
<!-- # the non-strict-XML mode using the empty iw_pt element
# negates the need for all the CDATA tags -->
<iw_pt name="press_release_rss"
/
>
<rss version="2.0" xmlns:dc="
http://purl.org/dc/elements/1.1/">
<channel>
<title>aaa Press Releases RSS</title>
<link>
http://www.aaa.com<
/link>
<description>Media Relations</description>
<language>en-us</language>
<category> Press Releases RSS Feed </category>
<iw_perl>
# iwmount makes this more portable. The use of 'my' is best practice
use TeamSite::Config;
my $iwmount = TeamSite::Config::iwgetmount();
my
$dir = "
$iwmount
/default/main/www/WORKAREA/MANUAL/templatedata/MANUAL/press_releases/data/";
# read directory of all dcr files
# You should always check open's / opendir's for success
if (
opendir(DIR, $dir)
{
my
@f
= grep !/^\.\.?$/, readdir(DIR);
closedir(DIR);
# for each file, extract title and insert link
foreach
my
$x (
@f)
{
# just in case there are subdirs - you might want to recurse ...
next if (-d "$dir/$x");
if (
open(FILE, "$dir/$x")
{
foreach
my
$line (<FILE>) {
# the 'sm' modifiers will allow the regex to work if the tags are on different lines
if($line =~ m|<title>(.*)</title>|i
sm
) {
iwpt_output("<title>$1</title>\n");
iwpt_output("<link><A href='
http://www.aaa.com/it/media/press_releases/$x'>$1<
/A></link>\n");
last;
}
if($line =~ m|<date>(.*)</date>|i
sm
) {
iwpt_output("<date>$d</date>\n");
last;
}
}
close(FILE);
}
}
}
</iw_perl>
</channel>
</rss>
Although not verified (I don't have your environment), I believe the above
should
work based on my understanding of the code you provided.
Hope that helps.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
getnaren
Fish,
Thats exactly, I needed, but the generated xml file has no data output from dcrs.
here is the source of the xml file generated
reddyl
I think you posted the html source when viewing the xml from UI, insted download the file and attach the file to the post.
Adam Stoller
Worse - I believe what was posted was the HTML of an IWOV page as opposed to the generated page from the DCR.
In addition - please provide details of how the page generation is being performed (through the GUI or via command line tools - if the latter show the exact command being used, etc.)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
getnaren
Fish here is the ipl used to generate
Adam Stoller
I think there are some logic issues in your script - like the fact that you have a foreach loop that sets $iwgenfile - but only use $iwgenfile *after* the loop has ended.
(
slightly reformatted for posting purposes
)
...
foreach
$iw_files
(
@iw_files){
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ )
{
$iwgen_template = $pr_template;
$dcrpath = "
...
";
$iwgenfile=$iw_files;
$htmlpath="/it/media/press_releases/";
}
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ )
{
$iwgen_template_pr_archive = $pr_archive_template;
$iwgenfile=$iw_files;
$dcrpath_pr_archive = "
...
";
$archivepath="/it/media/press_releases_archive/";
$generate_pr_archive = "yes";
}
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ )
{
$iwgen_template_pr_rss = $pr_rss_template;
$iwgenfile=$iw_files;
$dcrpath_pr_rss = "
...
";
$xmlpath="/it/media/press_releases_rss/";
$generate_pr_rss= "yes";
}
}
my ($junk,$dcrFilename) = split(/\/data\//,$iwgenfile);
my $iwgenCmd = $IWGENEXEC . " " . $iwgen_template . " "
. "-r /default/main/www/WORKAREA/MANUAL/
$iwgenfile
"
. " " . $dcrpath . $dcrFilename . ".html";
# Add debugging to log $iwgenCmd to a file, post results
my $cmd = `$iwgenCmd`;
my $htmlfile = $htmlpath . $dcrFilename . ".html";
...
My guess is that the actual command being run is not the command you think it is.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
getnaren
Fish,
I see the following job errors on the logs:
---------------------------------------------------------------------------------
[Thu Jan 5 16:26:51 2006] The path default/main/www/WORKAREA/MANUAL/it/media/press_release
s_rss/press_releases_rss.xml does not exist in area /default/main/www/WORKAREA/MANUAL.
[Thu Jan 5 18:13:11 2006] The path default/main/www/WORKAREA/MANUAL/it/media/press_release
s_archive/press_releases_archive.html does not exist in area /default/main/www/WORKAREA/MAN
UAL.
------------------------------------------------------
I can get the press_release generated without any problem.
I am trying to use the dcrs of the press releases and trying to generate an Archive and an RSS file using one ipl
my folder structure is :
/default/main/www/WORKAREA/MANUAL/it/media/press_releases
/default/main/www/WORKAREA/MANUAL/it/media/press_releases_archive
/default/main/www/WORKAREA/MANUAL/it/media/press_releases_rss
with the ipl I sent you...its generating press_releases and publishing it out
and press_releases_archive is generating press_releases_archive.html with 0 bytes in the generated folder and I see an empty folder on staging,
and press_releases_rss is generating press_releases_rss.xml with 0 bytes in the generated folder and I see an empty folder on staging
reddyl
You are missing the leading slash in the file path
Adam Stoller
This is when you're adding files to the task - yes?
Well - the leading slash *migh* be the problem - but I think the problem is that the workflow / task expects all the file path references to be *relative* to the workarea - and thus you should be adding:
/it/media/press_releases_rss/press_releases_rss.xml
/it/media/press_releases_archive/press_releases_archive.html
Not:
/default/main/www/WORKAREA/MANUAL/it/media/press_releases_rss/press_releases_rss.xml
/default/main/www/WORKAREA/MANUAL/it/media/press_releases_archive/press_releases_archive.html
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
getnaren
I removed /default/main/www/WORKAREA/MANUAL from both...$dcrpath_pr_rss and $dcrpath_pr_archive from the ipl, still same error...
part of ipl:
---------------------------------------
foreach $iw_files (
@iw_files){
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ )
{
$iwgen_template = $pr_template;
$dcrpath = "/default/main/www/WORKAREA/MANUAL/it/media/press_releases/";
$iwgenfile=$iw_files;
$htmlpath="/it/media/press_releases/";
}
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ )
{
$iwgen_template_pr_archive = $pr_archive_template;
$iwgenfile=$iw_files;
$dcrpath_pr_archive = "/default/main/www/WORKAREA/MANUAL/it/media/press_releases_archive/";
$archivepath="/it/media/press_releases_archive/";
$generate_pr_archive = "yes";
}
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ )
{
$iwgen_template_pr_rss = $pr_rss_template;
$iwgenfile=$iw_files;
$dcrpath_pr_rss = "/default/main/www/WORKAREA/MANUAL/it/media/press_releases_rss/";
$xmlpath="/it/media/press_releases_rss/";
$generate_pr_rss= "yes";
}
}
my ($junk,$dcrFilename) = split(/\/data\//,$iwgenfile);
my $iwgenCmd = $IWGENEXEC . " " . $iwgen_template . " " . "-r /default/main/www/WORKAREA/MANUAL/$iwgenfile" . " " . $dcrpath . $dcrFilename . ".html";
my $cmd = `$iwgenCmd`;
my $htmlfile = $htmlpath . $dcrFilename . ".html";
$task_obj->AddFile("$htmlfile", "FILE ADDED BY G1 Gen");
if ($generate_pr_archive eq "yes")
{
my $iwgenCmd = $IWGENEXEC . " " . $iwgen_template_pr_archive . " " . "-r /default/main/www/WORKAREA/MANUAL/$iwgenfile" . " " . $dcrpath_pr_archive . press_releases_archive . ".html";
my $cmd = `$iwgenCmd`;
my $htmlarchivefile = $dcrpath_pr_archive . press_releases_archive . ".html";
$task_obj->AddFile("$htmlarchivefile", "FILE ADDED BY G1 Gen");
}
if ($generate_pr_rss eq "yes")
{
my $iwgenCmd = $IWGENEXEC . " " . $iwgen_template_pr_rss . " " . "-r /default/main/www/WORKAREA/MANUAL/$iwgenfile" . " " . $dcrpath_pr_rss . press_releases_rss . ".xml";
my $cmd = `$iwgenCmd`;
my $xmlfile = $dcrpath_pr_rss . press_releases_rss . ".xml";
$task_obj->AddFile("$xmlfile", "FILE ADDED BY G1 Gen");
}
my $next_task = 0;
`/Interwoven/TeamSite/bin/iwcallback $task_id $next_task` if $task_id && defined($next_task);
--------------------------------------------------------------------------------------------------------------------------------------------
here is the workflow used to generte and publish the press release (it works perfect), which is also used for generating and publishing archive and rss :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE workflow SYSTEM "iwwf.dtd">
<!--
##############################################################################
# It will allow you to publish files on pressing Finish button on dcr.
#################################################################################
-->
<workflow name='G1 DCR Submit and Publish'
owner='appadmin'
creator='appadmin'
description='G1 DCR Submit and Publish'>
<externaltask name='Unlock_0'
owner='appadmin'
start='t'
description='unlocking files'>
<areavpath v='/default/main/www/WORKAREA/MANUAL'/>
<successors>
<successorset description='Done'>
<succ v='g1.generate'/>
</successorset>
</successors>
<command v='/Interwoven/TeamSite/local/bin/unlock.ipl'/>
<template_script>
<![CDATA[
if (__ELEM__('iw_file') != 0)
{
__INSERT__("<files>\n");
for (my $i=0; $i < __ELEM__('iw_file'); ++$i)
{
__INSERT__("<file path='__TAG__(iw_file[$i]);' comment=''/>\n");
}
__INSERT__("</files>\n");
}
]]>
</template_script>
</externaltask>
<externaltask name='g1.generate'
owner='appadmin'
description='Generate the html files'>
<areavpath v='/default/main/www/WORKAREA/MANUAL'/>
<successors>
<successorset description='Done'>
<succ v='g1.submit'/>
</successorset>
</successors>
<command v='/Interwoven/TeamSite/bin/www_dcr_generate.ipl'/>
</externaltask>
<submittask name='g1.submit'
owner='appadmin'
unlock='t'
override='t'
description='Submit to Staging'>
<areavpath v='/default/main/www/WORKAREA/MANUAL'/>
<successorset description='Done'>
<succ v='www File Deploy'/>
</successorset>
</submittask>
<!-- - - - - - - - - - - - - External Task for Deployment- - - - - - - -->
<externaltask name='www File Deploy'
owner='appadmin'
unlock='t'
override='t'
description='Deploying files for www'>
<areavpath v='/default/main/www/WORKAREA/MANUAL'/>
<successors>
<successorset description='Done'>
<succ v='End'/>
</successorset>
<successorset description='Notify user of file(s) deployment failure.'>
<succ v='Deployment error'/>
</successorset>
</successors>
<command v='/Interwoven/TeamSite/bin/agg_www_deploy.ipl'/>
</externaltask>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - ErrorInDeployment - - - - - - - - - - - - -->
<externaltask name='Deployment error'
owner='appadmin'
description='Failed to deploy files(s) to www'>
<areavpath v='/default/main/www/WORKAREA/MANUAL'/>
<successors>
<successorset description='Done'>
<succ v='End'/>
</successorset>
</successors>
<command v='/Interwoven/TeamSite/bin/agg_error_handler.ipl'/>
</externaltask>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<endtask name='End'>
</endtask>
</workflow>
Adam Stoller
You still haven't fixed the loop in your script - in fact it could use even more fixing than I realized when first looking at your code.
Right now it says (essentially):
foreach $iw_files (
@iw_files){
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ ){
...
$iwgenfile=$iw_files;
...
}
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ ){
...
$iwgenfile=$iw_files;
...
}
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ ) {
...
$iwgenfile=$iw_files;
...
}
}
...
my $iwgenCmd = "...-r /default/main/www/WORKAREA/MANUAL/$iwgenfile ...";
...
when it should probably be something more like:
foreach $iw_files (
@iw_files){
if( $iw_files =~ /^(.*?)(press_releases)(.*?)/ ){
...
$iwgenfile=$iw_files;
...
}
...
my $iwgenCmd = "...-r /default/main/www/WORKAREA/MANUAL/$iwgenfile ...";
...
}
You only need one
if
statement - since they are all testing for the exact same match (or perhaps your regex's need to be fixed?) and you only need to set $iwgenfile once (actually, you don't need to set it at all - you can just use $iw_files) and the usage of $iwgenfile (or $iw_files)
after
the
if
statement should be
within
the
foreach
loop.
Now, back to the error messages regarding the path such-and-such does not exist in workarea such-and-such. These most likely come from:
$task_obj->AddFile("$htmlfile", "FILE ADDED BY G1 Gen");
and
$task_obj->AddFile("$htmlarchivefile", "FILE ADDED BY G1 Gen");
and
$task_obj->AddFile("$xmlfile", "FILE ADDED BY G1 Gen");
Can you please verify what the actual values of
$htmlfile
,
$htmlarchivefile
, and
$xmlfile
are? From my reading of the code -
$htmlfile
is correctly relative to the workarea, but the other two are still using the full area-vpath instead of a relative-path.
That's about as far as I'm willing to go with this - the script needs a lot more work IMO.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
bar-char-01.jpg