|
Hello, > How would I go about replacing the < with < if that file > was loaded as a template before writing the template to the > web page? First, let me disclaim: I know absolutely nothing about CGIDEV2. I'm only familiar with "normal" CGI programming (i.e. without a toolkit) Some day I'm going to learn CGIDEV2 (someday, someday...) However, what I do is use the following subprocedure to convert the special characters into HTML-friendly variants: *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * FixChar(): This trims trailing blanks from a source record, * adds a newline and converts * & to & * < to < * > to > *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P FixChars B D FixChars PI D SrcDta 1024A const varying options(*varsize) D Output 4096A varying D html_format 1N const D HeavyTags 1N const D Len s 10I 0 D x s 10I 0 D Char s 1A /free Len = %len(%trimr(SrcDta)); %len(Output) = 0; for x = 1 to Len; Char = %subst(SrcDta: x: 1); if (html_format); if (Char = '<'); Output += '<'; elseif (Char = '>'); Output += '>'; elseif (Char = '&'); Output += '&'; else; Output += Char; endif; else; Output += Char; endif; endfor; if (html_format and HeavyTags); Output += '<br>'; endif; Output += x'0d25'; /end-free P E I imagine that if you created a CGIDEV2 thinngy, you wouldn't need to add the <BR> or whatever to the end of the data. You'd want your template to use <PRE> and </PRE> most likely instead. Then, of course, I'd read the file in my RPG program and run line of input through the above subprocedure... then write it out to stdout (or in your case, to the CGIDEV2 template.)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.