<? print .. DIV> + InnerHTML question, thank you

<? print .. DIV> + InnerHTML question, thank you

am 25.08.2007 20:24:41 von encepif

Hopefully someone can give me definitive answer:

What steps can I take to do this process, so no breakdowns in
presentation occurs when I use,





So, someblog[0] might have weird characters, un-escaped whatevers,
that clog of the div presentation. I am not sure what to catch or
what converters to use. What are basic considerations & science do I
need to apply to the string prior to presentation in the div? :-)

Thank you for assistance. Have a good day.

Re: <? print .. DIV> + InnerHTML question, thank you

am 25.08.2007 21:06:38 von Jerry Stuckle

encepif@gmail.com wrote:
> Hopefully someone can give me definitive answer:
>
> What steps can I take to do this process, so no breakdowns in
> presentation occurs when I use,
>
>
>
>


>
> So, someblog[0] might have weird characters, un-escaped whatevers,
> that clog of the div presentation. I am not sure what to catch or
> what converters to use. What are basic considerations & science do I
> need to apply to the string prior to presentation in the div? :-)
>
> Thank you for assistance. Have a good day.
>

Why did you post this to alt.php? There's no PHP code here.

Followup set to comp.lang.javascript only.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: <? print .. DIV> + InnerHTML question, thank you

am 25.08.2007 21:32:48 von luiheidsgoeroe

On Sat, 25 Aug 2007 20:24:41 +0200, wrote:

> Hopefully someone can give me definitive answer:
>
> What steps can I take to do this process, so no breakdowns in
> presentation occurs when I use,
>
>
>
>


>
> So, someblog[0] might have weird characters, un-escaped whatevers,
> that clog of the div presentation. I am not sure what to catch or
> what converters to use. What are basic considerations & science do I
> need to apply to the string prior to presentation in the div? :-)

(If no html is allowed, either htmlspecialchars or striptags.)

Replace linebreaks with literal '\n'. Escape quotes. And finally: make =

sure it's in the right character set.
-- =

Rik Wasmus

Re: <? print .. DIV> + InnerHTML question, thank you

am 25.08.2007 22:46:48 von severin

You have to be very carefull concening ',", and htmlentities...

use evry times EXEACTLY the same syntax. Espacially if $someblog[0] may
be modified by the user.

Moreover, i dont like your: '
You may write something like:


carriage returns and dblquote(") will be OK.

for single quote(') the right syntax may be:
ereg_replace( "'","\'",$someblog[0] )
or ereg_replace( "'","\\'",$someblog[0] )
or ereg_replace( "'","\\\'",$someblog[0] )

try all of this.
good luck;



encepif@gmail.com wrote:
> Hopefully someone can give me definitive answer:
>
> What steps can I take to do this process, so no breakdowns in
> presentation occurs when I use,
>
>
>
>


>
> So, someblog[0] might have weird characters, un-escaped whatevers,
> that clog of the div presentation. I am not sure what to catch or
> what converters to use. What are basic considerations & science do I
> need to apply to the string prior to presentation in the div? :-)
>
> Thank you for assistance. Have a good day.
>

Re: <? print .. DIV> + InnerHTML question, thank you

am 26.08.2007 04:13:24 von luiheidsgoeroe

On Sat, 25 Aug 2007 22:46:48 +0200, Séverin Richard
wrote:

> You have to be very carefull concening ',", and htmlentities...
>
> use evry times EXEACTLY the same syntax. Espacially if $someblog[0] may
> be modified by the user.
>
> Moreover, i dont like your: ' >
> You may write something like:
>
>
> carriage returns and dblquote(") will be OK.

When did newlines in javascript strings become OK?

>
> for single quote(') the right syntax may be:
> ereg_replace( "'","\'",$someblog[0] )
> or ereg_replace( "'","\\'",$someblog[0] )
> or ereg_replace( "'","\\\'",$someblog[0] )
>
> try all of this.

And more, or better yet, not at all, at least not these constructs.
--
Rik Wasmus

Re: <? print .. DIV> + InnerHTML question, thank you

am 26.08.2007 16:58:16 von Gregor Kofler

Séverin Richard meinte:

> for single quote(') the right syntax may be:
> ereg_replace( "'","\'",$someblog[0] )
> or ereg_replace( "'","\\'",$someblog[0] )
> or ereg_replace( "'","\\\'",$someblog[0] )
>
> try all of this.

Now, that's what I call helpful... Anyway, since he's doing a lot of
trying anyway, he should either stick to preg_replace() if RegEx are
required, since *this* is proper contemporary PHP. However, in this case
RegEx is complete overkill. An ordinary str_replace() will do [1].

Gregor


[1] http://at2.php.net/str_replace


--
http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
http://www.licht-blick.at ::: Forum für Multivisionsvorträge
http://www.image2d.com ::: Bildagentur für den alpinen Raum

Re: <? print .. DIV> + InnerHTML question, thank you

am 27.08.2007 04:46:58 von Steve

"Gregor Kofler" wrote in message
news:96556$46d1954d$557f14a8$2321@news.inode.at...
| Séverin Richard meinte:
|
| > for single quote(') the right syntax may be:
| > ereg_replace( "'","\'",$someblog[0] )
| > or ereg_replace( "'","\\'",$someblog[0] )
| > or ereg_replace( "'","\\\'",$someblog[0] )
| >
| > try all of this.
|
| Now, that's what I call helpful...

man, there are a ton of prima donnas here! jesus christ!

| Anyway, since he's doing a lot of
| trying anyway, he should either stick to preg_replace()

i agree...it gives much better performance.

| if RegEx are
| required, since *this* is proper contemporary PHP.

"proper"?!!! wtf!

ummmm...ereg *IS* using regex. it's just a different processing engine.
"proper"...that's a laugh.

| However, in this case
| RegEx is complete overkill.

disagree completely.

| An ordinary str_replace() will do [1].

only if you're not used to writing regex. but to technically disagree, no,
str_replace won't easily take care of everything that should be checked.