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)
TEXT File Output
Leo
Hi,
I ave a Presentation template which generates the output as a text file. No doubt, all the contents that I enter thru the DCR are appear in the output file, but it looks totally messed up in terms of alignment! Also, I see all the HTML tags are appearing in the output.
How do I get away with this and get a clean formatted aligned output in a text file? Rather, How do I control the alignment to be effected in my output text file thru my Presentation Template?
This is how I've coded in my PT
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="Email NewsLetter Presentation Template">
<![CDATA[
My Sample Newsletter
]]>
<iw_value name='dcr.Date'/>
<![CDATA[
DEAR %TITLE% %FAMILYNAME%
]]>
<iw_iterate var='SectionParagraphs' list='dcr.SectionParagraphs'>
<iw_if expr="{iw_value name='SectionParagraphs.Sub Header'/}ne ''">
<iw_then>
<![CDATA[
<iw_value name='SectionParagraphs.Sub Header'/>
<iw_value name='SectionParagraphs.Body Text'/>
<iw_value name='SectionParagraphs.Fine Print'/>
]]>
</iw_then>
</iw_if>
</iw_iterate>
<![CDATA[
--------------------------------------------------------------
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine. Text that appear fine.
]]>
</iw_pt>
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
Is this the way PT to be coded for the text output?
The part that is displayed messy is the one that is inside the <iw_iterate> block. The content for Sub Header & Body Text is entered in the DCR thru Visualformat and I feel that could be the reason for the HTML tags appearing in the output file - Correct me if I'm wrong.
Any soultions?
TIA
- Leo
Find more posts tagged with
Comments
Dwayne
The content for Sub Header & Body Text is entered in the DCR thru Visualformat and I feel that could be the reason for the HTML tags appearing in the output file
You are quite correct. VF fields are specifically designed to be used from within HTML. They really don't make sense in any other context.
If you want the text without the HTML, then you've got some work to do. You'll need to some up with some method of removing the HTML from the text, but that's not as easy as it sounds. You can try just throwing away the tags, and leave behind the text, but that usually doesn't look very good. There are Perl modules for parsing HTML, but I'm not sure how much they're going to help you.
If you're using these fields as just text, why have them be VF at all? Why not just simple text areas?
--
Current project: TS 5.5.2/6.1 W2K
Leo
Thanks Dwayne!
What you said is true - Why at all use the VF if i need only the text output?
But, the problem is I have 1 DCT and 2 PTs (1 for HTML output and 1 for Text). So, I need to have the VF for the Body text of the HTML format.
1. Is there a way to get the contents of this Body Text Value in my TextFormat.tpl and convert it to text? OR
2. Have 2 Body text sections in the DCT (BT-1 and BT-2 for HTML input and Text input respectively) and control the same in my PT? OR
3. Any utility that I can use in my PT to convert the BodyText HTML part to Text. Please let me know where i can find this kind of a utility?
Any other suggestions. I HAVE TO GIVE A SOLUTION TO ONE OF MY CLIENT. Everything else is working fine except for this text alignment and tags (looks simple)
Anyone having any other alternatives? please update me as fast as you can!!.
Thanks in million in advance
- Leo
Adam Stoller
Then I guess you'd have to look at using something like HTML:
arser and creating your own start/end/text methods for handling the parsing of the VF fields - you could probably create a handler for start tags that does "the right thing" for simple tags like 'b', 'i', 'u', 'tt' - and then handle more complex tags like 'ul', 'ol', 'li' - perhaps stripping away all content for tags like 'img' - but then there's even more complex processing for things like 'table', 'tr', 'td', 'th', etc. and I'm not sure what you'd want to do with 'a href=...' tags (do you show the href data in-line or strip it out completely?
It's certainly do-able, but expect whatever you code up to be a 'living' module as you will probably have to keep coming back to it and adding more functionality to handle tags that you didn't think of previously.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com