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)
opening whitespace in PT
Ottawa_IWOV
HI All -
I am using a PT to generate form a DCR, that will form a piece of a webpage
For some reason, I always get a blank line at the beginning the output page. I don't know why the PT is doing this, but it is affecting the fomatting on the main page.
I am using <iw_perl> ... </iw_perl> blocks to generate the snippet
so essentially the PT outputs:
BLANK LINKE
snippet of HTML
How do I get rid of the blank line?
Thanks,
Find more posts tagged with
Comments
Migrateduser
Could you attach your PT or post, say, the first 20 lines of your PT?
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP2 on W2K
(3) TS 6.1 on W2K
Adam Stoller
What are the first 5 (arbitrary number) of your PT?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Ottawa_IWOV
Here you go:
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="Common Navigation TPL">
<iw_perl>
<![CDATA[
my $count = iwpt_dcr_list('dcr.navigation');
for (my $i=0;$i<$count;$i++) {
my $alt = iwpt_dcr_value('dcr.navigation[$i].alt');
my $url = iwpt_dcr_value('dcr.navigation[$i].url');
my $image = iwpt_dcr_value('dcr.navigation[$i].image');
my $height = iwpt_dcr_value('dcr.navigation[$i].height');
my $width = iwpt_dcr_value('dcr.navigation[$i].width');
my $jsObject = $image;
### Convert the image name into the JavaScript object
### for the rollover script (03/23/2005 BAU)
$jsObject =~ s/(^.*-)(.+)(-.*$)/$2/ig;
$jsObject =~ s/vtb/imgv/ig;
$jsObject =~ s/(^.*)(_.*$)/$1/ig;
### Assemble the HTML snippet
my $link = "<a href=\"$url\" onMouseOut=\"inact('$jsObject');\" onMouseOver=\"act('$jsObject');\"><img src=\"$image\" alt=\"$alt\" name=\"$jsObject\" width=\"$width\" height=\"$height\" border=\"0\"></a><br>";
### Output the snippet to the template
#iwpt_output (qq($link));
}
]]>
</iw_perl>
</iw_pt>
Migrateduser
Your PT looks just fine. Okay, I know -- this is not news, but... have you tried inserting output statements here and there and then regenning to try and capture where it's happening?
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP2 on W2K
(3) TS 6.1 on W2K
Ottawa_IWOV
I can trap an iwpt_output for that new line. It is just there all the time. If I print before the loop. Seems very odd to me ...
Migrateduser
I don't think I'm understanding your post... are you saying that the newline appears within the loop? Or, are you saying it occurs even before <iw_perl> (of course, it wouldn't be iwpt_output if there)?
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP2 on W2K
(3) TS 6.1 on W2K
Jeremy
Hi,
Just a shot in the dark - I've had these kind of problems before - I normally try get everything onto one line then try figure out where it was going wrong.
So try changing the beginning to be something like :
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="Common Navigation TPL"><iw_perl><![CDATA[
or if that doesn't work try :
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="Common Navigation TPL">
<iw_perl><![CDATA[
my $count = iwpt_dcr_list('dcr.navigation');
HTH
Jeremy
Adam Stoller
Try changing:
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="Common Navigation TPL">
<iw_perl>
<![CDATA[
my $count = iwpt_dcr_list('dcr.navigation');
for (my $i=0;$i<$count;$i++) {
my $alt = iwpt_dcr_value('dcr.navigation[$i].alt');
...
#iwpt_output (qq($link));
}
]]>
</iw_perl>
</iw_pt>
to:
<iw_pt name="Common Navigation TPL"
/
>
<iw_perl>
my $count = iwpt_dcr_list('dcr.navigation');
for (my $i=0;$i<$count;$i++) {
my $alt = iwpt_dcr_value('dcr.navigation[$i].alt');
...
#iwpt_output (qq($link));
}
</iw_perl>
Note:
The absence of an XML header
The
<iw_pt/>
element is an
empty
element instead of a
containing
element
The removal of all
'<![CDATA['
and
']]>'
tags.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com