Title: RE: [Dynapi-Help] Scroll and inlines.

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

Reply via email to