Connecting Tech Pros Worldwide Forums | Help | Site Map

innerHTML and PHP string parsing

endlesstide@gmail.com
Guest
 
Posts: n/a
#1: Apr 12 '06
Is there a PHP command to convert a $string of HTML into something
friendly for innerHTML population? I get a undtermined string constant
error sometimes.


Evertjan.
Guest
 
Posts: n/a
#2: Apr 12 '06

re: innerHTML and PHP string parsing


wrote on 12 apr 2006 in comp.lang.javascript:
[color=blue]
> Is there a PHP command to convert a $string of HTML into something
> friendly for innerHTML population? I get a undtermined string constant
> error sometimes.[/color]

There are no PHP commands in Javascript.

Try another NG.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Erwin Moller
Guest
 
Posts: n/a
#3: Apr 12 '06

re: innerHTML and PHP string parsing


endlesstide@gmail.com wrote:
[color=blue]
> Is there a PHP command to convert a $string of HTML into something
> friendly for innerHTML population? I get a undtermined string constant
> error sometimes.[/color]

Hi,

If your HTML is not suitable to insert somewhere with innerHTML, try to find
the reason WHAT is causing that.

There is no such thing as 'special innerHTML' encoding.
It is all just html, only retrieved in a different way (via XMLHttpRequest).

I would suggest you try to isolate when this happens, and call the script
that returns the offending html directly.
Then see if you agree with the returned HTML.

It could be a PHP codingmistake, or mayby you are trying to send Javascript
back. (The latter is more difficult, if this is the case: ask again.
Several solutions exists)

Regards,
Erwin Moller

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#4: Apr 12 '06

re: innerHTML and PHP string parsing


endlesstide@gmail.com wrote:
[color=blue]
> Is there a PHP command to convert a $string of HTML
> into something friendly for innerHTML population?[/color]

You need to escape "</" as "<\/" if PHP generates
script code as content of a HTML `script' element.
PHP programming is off-topic here.
[color=blue]
> I get a undtermined string constant error sometimes.[/color]

"Doctor, I'm ill sometimes. What did I do wrong?"

<URL:http://jibbering.com/faq/faq_notes/pots1.html>


PointedEars
Tony
Guest
 
Posts: n/a
#5: Apr 12 '06

re: innerHTML and PHP string parsing


Thomas 'PointedEars' Lahn wrote:[color=blue]
> endlesstide@gmail.com wrote:
>[color=green]
>>Is there a PHP command to convert a $string of HTML
>>into something friendly for innerHTML population?[/color]
>
> You need to escape "</" as "<\/" if PHP generates
> script code as content of a HTML `script' element.[/color]

Not necessarily.
[color=blue]
> PHP programming is off-topic here.[/color]

Exactly. OP shoudl try
alt.php
comp.lang.php
[color=blue][color=green]
>>I get a undtermined string constant error sometimes.[/color]
>
> "Doctor, I'm ill sometimes. What did I do wrong?"[/color]

LOL
[color=blue]
> <URL:http://jibbering.com/faq/faq_notes/pots1.html>[/color]

But don't parody it in this NG, right?
Randy Webb
Guest
 
Posts: n/a
#6: Apr 12 '06

re: innerHTML and PHP string parsing


Thomas 'PointedEars' Lahn said the following on 4/12/2006 8:23 AM:[color=blue]
> endlesstide@gmail.com wrote:
>[color=green]
>> Is there a PHP command to convert a $string of HTML
>> into something friendly for innerHTML population?[/color]
>
> You need to escape "</" as "<\/" if PHP generates
> script code as content of a HTML `script' element.[/color]

That's debatable.
[color=blue]
> PHP programming is off-topic here.[/color]

That is true, but, the implications of what PHP generates to Javascript
executing in the UA *is* on-topic here. And in order to know what to do
in PHP to make it JS friendly then you have to find out what is JS
friendly first. And you find that out - gasp - in a Javascript
newsgroup, not in a PHP group.
[color=blue][color=green]
>> I get a undtermined string constant error sometimes.[/color]
>
> "Doctor, I'm ill sometimes. What did I do wrong?"[/color]

Umm, you read too many of Thomas' Usenet posts?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
optimistx
Guest
 
Posts: n/a
#7: Apr 13 '06

re: innerHTML and PHP string parsing



"Randy Webb" <HikksNotAtHome@aol.com> kirjoitti viestissä
news:CPidnWArG_q496DZnZ2dneKdnZydnZ2d@comcast.com. ..[color=blue]
> Thomas 'PointedEars' Lahn said the following on 4/12/2006 8:23 AM:[/color]
....
[color=blue][color=green]
> > "Doctor, I'm ill sometimes. What did I do wrong?"[/color]
>
> Umm, you read too many of Thomas' Usenet posts?
>[/color]
:-)

'Yes doctor. I love to hate them. Have I an Asperger syndrome?'


Closed Thread