Simon's solution sounds good. I also have an untested JavaScript trick
for this from RedDot UK, which puts the placeholder content inside a
JavaScript comment inside a JavaScript function, and uses
function.toString() to get at the function's source code and a regular
expression to extract it from the comment. Very clever, if it works -
looking at it I can't believe that you can call a JavaScript function
from inside ASP, but I've never used runat="server" before. Simon's
solution is cleaner as long as the change doesn't have any unwanted
side-effects.
<script language="JScript" runat="server">
function get_placeholder(name) {
var re = /\/\*((?:.|\n)*)\*\//;
return re.exec(eval("var_" + name + ".toString()"))[1];
}
function var_txt_content() {
/*<%txt_content%>*/
}
</script>
<%
txt_content = get_placeholder("txt_content")
%>
On Oct 22, 11:34 pm, bushland25 <[EMAIL PROTECTED]> wrote:
> Hi Simon,
>
> I don't encounter the same problem as you when I read similar
> placeholders in asp code. The value I get back from the placeholder is
> in HTML, and so I get back something like "Hello World". You
> should check that the placeholder is output in HTML format to prevent
> this from happening. When you edit the placeholder, check that the you
> have 'Do not convert characters to HTML' unchecked.
>
> On Oct 22, 4:56 am, "Simon Lewis, UK" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi all,
>
> > I'm struggling with a really fundamental problem and wondering if
> > anyone has any bright ideas...
>
> > I need to put the contents of a standard text placeholder into an ASP
> > variable so that I can use ASP to manipulate the text. Here's the
> > only way I know how:
>
> > <%
> > my_asp_variable = "<%std_reddot_text_placeholder%>"
> > %>
>
> > That's perfect until someone puts a value in the placeholder that
> > contains a quote character, because when ASP reaches the quote
> > character, it thinks the string assignation has ended, and throws an
> > error on the remaining contents of the placeholder.
>
> > I thought of using the Replace function in various ways...
>
> > <%
> > my_asp_variable = Replace("<%std_reddot_text_placeholder%>", """",
> > Chr(34))
> > %>
>
> > <%
> > my_asp_variable = escape("<%std_reddot_text_placeholder%>")
> > %>
>
> > ...but the simple truth is that the problem lies in the fact that
> > this:
>
> > "<%std_reddot_text_placeholder%>"
>
> > ...is effectively turned into this:
>
> > "here is the text in my placeholder which contains "quoted" text"
>
> > I'm sure loads of other people have met this problem... any ideas on
> > how to get round it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"RedDot CMS Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/RedDot-CMS-Users?hl=en
-~----------~----~----~----~------~----~------~--~---