Replace coldfusion替换功能工作不正常

Replace coldfusion替换功能工作不正常,replace,coldfusion,Replace,Coldfusion,以下是一个文档,存储在一个名为Templet的变量中: {{d {{h Dear Customer, We were so pleased that you have signed up for one of our programs. Below please find a listing of what you signed up for. {{r Sincerely Yours, John Jones President XYZ Corporation 我打算用用户选择

以下是一个文档,存储在一个名为Templet的变量中:

{{d

{{h

Dear Customer,

We were so pleased that you have signed up for one of our programs.  Below please find a listing of what you signed up for.

{{r

Sincerely Yours,

John Jones
President  
XYZ Corporation
我打算用用户选择的信息替换
{{d
{h和
{r
{d
是日期,
{h
是标题,
{r
是报告。进行此替换的代码是:

<cfset templlet = Replace(templlet, "{{d", "#repdatemm#")>
<cfset templlet = Replace(templlet, "{{h", "#heading#")>
<cfset templlet = Replace(templlet, "{{r", "#letrep#")>
(很抱歉这里有这么多的点--我不知道如何在里面加空格)

您可以看到
templet
中的
{{r
位于签名之前,但报告显示在签名行之后


我试着在
templet
中在
{r
和签名之间留出更多的空间,这没有什么区别。我试着把
{r
放在一个div中,这没有什么区别。我很困惑为什么这个出现在错误的地方。有人能告诉我这里出了什么问题吗?

问题是:

<table>

未正确关闭随附的报告

这项工作:

<cfsavecontent variable="content">
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <script type = "text/javascript"> fieldsplitput('moxlet', '�', 'x_1', 1) </script> <p style="margin-left:40px">{{d</p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">{{h</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Dear Customer,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">We were so pleased that you have signed up for one of our programs.&nbsp; Apparently you live in the city of Philadelphia.&nbsp; Additionally we observe that you were referred to us by 191.&nbsp; Below please find a listing of what you signed up for.</span></span></p> <div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <link rel="stylesheet" type = "text/css" href ="persrep.css"/> <style type="text/css"> @media print { table tr.page-break{page-break-before:always} } </style> <HTML> <head> <link rel="stylesheet" type = "text/css" href ="betty.css"/> </head> <body> </body> </html> <div style = "margin:auto;overflow:auto; " >{{r</span></span></p> </div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Sincerely Yours,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">John Jones<br /> President<br /> XYZ Corporation</span></span></p> 
</cfsavecontent>

<cfset date = "July 06, 2018">

<cfsavecontent variable="header">
Mr. Joseph Smith<br />
1632 S. Bailey St.<br />
Philadelphia, PA 19145
</cfsavecontent>

<cfsavecontent variable="report">
<table class = "reptable" id = 'reptable' > <tr><td>&nbsp;</td></tr> <td>&nbsp; </td> <td class = "repcolhead1">Activity Code</td> <td class = "repcolhead1">Amount Paid</td> <td class = "repcolhead1">Note</td> <td><input type = "text" id = "repfoc" class = "inpbl" value = "" style = "lineheight: 2px; width:2px" > </td> </tr> <script type = "text/Javascript"> thefocus('repfoc') function thefocus(id) { //alert("got to thefocus id is " + id); document.getElementById(id).focus(); } </script> <td style = "padding-left: 0px; padding-top: 10px " class = "repsubh"> State: PA </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left: 10px; " class = "repsubh"> Trans. Date: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "color: #141212; text-align: left;" > EarlyReg </td> <td class = "repcolrow" style = "color: #141212; text-align: right;" > 500.00 </td> <td class = "repcolrow" style = "color: #141212; text-align: left;" > </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left:10px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-2-1','cnt-2-2', 'brk-2-4-1', 'brk-2-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td style = "padding-left:0px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: PA </td> <!--up counter on this subhead where appropriate ---> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-3-1','cnt-3-2', 'brk-3-4-1', 'brk-3-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td class = 'repsubf' style = "font-weight:bold"> Report Total : <br> <a class = "repnum" id = "cnt-4-1" style = ""> Count : </a> <a class = "repnum" id = "cnt-4-2" style = "; ">1 </a> </p> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-4-1','cnt-4-2', 'brk-4-4-1', 'brk-4-4-2') </script> <td class = "repcolrow" style = "text-align: right;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <tr><td>&nbsp;</td></tr><table>
</cfsavecontent>

<cfset content = ReplaceNoCase(content,"{{d",date)>
<cfset content = ReplaceNoCase(content,"{{h",header)>
<cfset content = ReplaceNoCase(content,"{{r",report)>

<cfoutput>
#content#
</cfoutput>

fieldsplitput('moxlet','�', '亲爱的客户,

{d

{h

亲爱的客户>我们很高兴你注册了我们的一个项目。显然你住在费城。此外,我们注意到你是191年向我们介绍的。下面请查找你注册的项目列表。

@media print{table tr.page-break{page break before:always}{{r

衷心感谢您的,

约翰·琼斯
XYZ公司总裁
约瑟夫·史密斯先生
1632圣贝利街
宾夕法尼亚州费城,19145 活动代码支付金额注意事项焦点('repfoc')函数焦点(id){//alert(“到达焦点的id为“+id”);document.getElementById(id.focus();}状态:PA交易日期:2017年6月11日EarlyReg 500.00小计:2017年6月11日placecount('cnt-2-1','cnt-2-2','brk-2-4-1','brk-2-4-2'))500.00小计:PA placecount('cnt-3-1','cnt-3-2','brk-3-4-1','brk-3-4-2')500.00报告总计:
计数:1

placecount('cnt-4-1','cnt-4-2','brk-4-4-1','brk-4-4-2')500.00 #内容#
明天我会更详细地看一看这个,但是如果你使用{{r}}作为占位符会发生什么?你能分享构建模板文档的代码吗?实际文档内容是html还是文本?如果是html,这可以解释元素为什么会移动…你能发布一个小示例来重现“签名后出现的报告”?@snackboy——代码是由ckeditor生成的,非常糟糕,但我会很快为您整理好它。@ageax实际的文档是html(ckeditor中非常糟糕的html)。如果这导致了位移,我能做些什么来纠正它?我发布了“签名后出现的报告”“在最初的问题中。不幸的是,这个网站没有正确地呈现报告,我也不知道如何保留空格,所以我用点填充。但是你在问题中看到的是我得到的。你没有看到一个。你看到的正是我从一个on模板中得到的(减去点和缺少css).你说得很对。我有报告的外部文件。它现在正在工作。我没想到会看那里,非常感谢你的帮助。
<cfsavecontent variable="content">
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <script type = "text/javascript"> fieldsplitput('moxlet', '�', 'x_1', 1) </script> <p style="margin-left:40px">{{d</p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">{{h</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Dear Customer,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">We were so pleased that you have signed up for one of our programs.&nbsp; Apparently you live in the city of Philadelphia.&nbsp; Additionally we observe that you were referred to us by 191.&nbsp; Below please find a listing of what you signed up for.</span></span></p> <div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <link rel="stylesheet" type = "text/css" href ="persrep.css"/> <style type="text/css"> @media print { table tr.page-break{page-break-before:always} } </style> <HTML> <head> <link rel="stylesheet" type = "text/css" href ="betty.css"/> </head> <body> </body> </html> <div style = "margin:auto;overflow:auto; " >{{r</span></span></p> </div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Sincerely Yours,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">John Jones<br /> President<br /> XYZ Corporation</span></span></p> 
</cfsavecontent>

<cfset date = "July 06, 2018">

<cfsavecontent variable="header">
Mr. Joseph Smith<br />
1632 S. Bailey St.<br />
Philadelphia, PA 19145
</cfsavecontent>

<cfsavecontent variable="report">
<table class = "reptable" id = 'reptable' > <tr><td>&nbsp;</td></tr> <td>&nbsp; </td> <td class = "repcolhead1">Activity Code</td> <td class = "repcolhead1">Amount Paid</td> <td class = "repcolhead1">Note</td> <td><input type = "text" id = "repfoc" class = "inpbl" value = "" style = "lineheight: 2px; width:2px" > </td> </tr> <script type = "text/Javascript"> thefocus('repfoc') function thefocus(id) { //alert("got to thefocus id is " + id); document.getElementById(id).focus(); } </script> <td style = "padding-left: 0px; padding-top: 10px " class = "repsubh"> State: PA </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left: 10px; " class = "repsubh"> Trans. Date: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "color: #141212; text-align: left;" > EarlyReg </td> <td class = "repcolrow" style = "color: #141212; text-align: right;" > 500.00 </td> <td class = "repcolrow" style = "color: #141212; text-align: left;" > </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left:10px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-2-1','cnt-2-2', 'brk-2-4-1', 'brk-2-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td style = "padding-left:0px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: PA </td> <!--up counter on this subhead where appropriate ---> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-3-1','cnt-3-2', 'brk-3-4-1', 'brk-3-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td class = 'repsubf' style = "font-weight:bold"> Report Total : <br> <a class = "repnum" id = "cnt-4-1" style = ""> Count : </a> <a class = "repnum" id = "cnt-4-2" style = "; ">1 </a> </p> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-4-1','cnt-4-2', 'brk-4-4-1', 'brk-4-4-2') </script> <td class = "repcolrow" style = "text-align: right;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <tr><td>&nbsp;</td></tr><table>
</cfsavecontent>

<cfset content = ReplaceNoCase(content,"{{d",date)>
<cfset content = ReplaceNoCase(content,"{{h",header)>
<cfset content = ReplaceNoCase(content,"{{r",report)>

<cfoutput>
#content#
</cfoutput>