Thanks a lot, it didn't solve the entire problem but it sure was close.
This is how i did it.
First i read the file with file() as I was told, and then, to really get rid of all
'\n' I used ereg_replace. Now it works as a charm.
contentLayer.setHTML('<?
for ($i=0; $i<count($pagecontent); $i++)
print(addslashes(ereg_replace("\n", "\0",$pagecontent[$i]))); ?>')
/Johan Andr�n
On Tue, 22 May 2001 09:21:33 -0600
"Pickup, Jordan" <[EMAIL PROTECTED]> wrote:
> The quotes aren't your only problem. When you do an include in PHP, it just
> dumps the output to the user, new lines and all. In this case the "s won't
> mess you up, 's will. Also \n and \r.
>
> Since it is not likely possible to ensure that your included document has no
> ",',\r,\n in it, it is not possible to use the include like that.
>
> I suggest reading in the files content in PHP using file() to get each line
> read into a separate item in a PHP array, then do an
> addslashes(pagecontent[$i]) to each array item to handle the quotes. Use
> this code:
>
> anyLayer.setHTML('<?
> for ($i=0; $i<count($pagecontent[$i]; $i++)
> print(addslashes($pagecontent));
> ?>');
>
> If you miss the new lines (which I took out), you could do this:
>
> anyLayer.setHTML('<?
> for ($i=0; $i<count($pagecontent[$i]; $i++)
> print(addslashes($pagecontent)."\\n");
> ?>');
>
> The two slashes are on purpose, php will remove one of the slashes when it
> prints it out, leaving a \n for the javascript.
>
> The above solutions do not execute the php code. If you want the php file to
> still be executed with php, you'll have to figure out a way to have the code
> execute without printing out any new lines and with slashes before the
> quotes. Good Luck.
>
> Jordan
>
> -----Original Message-----
> From: Johan Andr�n [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 21, 2001 3:55 PM
> To: [EMAIL PROTECTED]
> Subject: [Dynapi-Help] Scroll and inlines.
>
>
> Hi,
> Im working on this homepage for my band, and I have really ran my head into
> a stonewall.
>
> This is the thing, I have a page with a topbanner and a linkpanel on the
> left, I donot want to use frames and instead I use php and include() the
> content of the page.
>
> Now, I have this fix idea of limiting the textarea and use to buttons to
> scroll
> the text that doesnt fit the screen, not scrollbars.
>
> Since anyLayer.setHTML(' <? include("filename") ?> ') wont work, since i
> also have some <p class="blabla" style="yadayada"> tags in the files and the
> \" will break it.
>
> How should I solve this?
> /Johan Andr�n
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help