Jump to content


Photo

AJAX problem with PHP or PHP Problem with itself?


  • Please log in to reply
3 replies to this topic

#1 mattkirkey

mattkirkey
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 01 June 2006 - 06:53 PM

I'm new here, but I have a problem.

I have a help file stored in a database. The help file has both HTML, PHP, CSS and javascript (non-ajax stuff).

When the info is pulled (using PHP), it is dumped into a $body variable and then printed. Essentially, what I have is a webpage within a webpage. BUT, none of the php or external javascript linking in the $body is being processed (or the CSS I think).

So we have the initial page:
print("<div id=help height='95%' width='95%' bgcolor=#ffffff>");
    include ("help-getPage.php");
print("</div>");

then the help-getPage.php important code is:
for ($i = 0; $i < $numParts; $i++) {
    $body .= stripslashes($partsArr["VALUE"][$i]);
}
        
print ($body);    


$body will contain a bunch of html, php, css, javascript links.

I can't seem to get it to process correctly. Does anyone have any helpful tips/suggestions?

Thanks,
-Matt

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 01 June 2006 - 08:06 PM

instead of print ($body); use eval($body);

if php stored as a string, you need to use the eval function
[a href=\"http://us2.php.net/manual/en/function.eval.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.eval.php[/a]

NoGray.com


#3 mattkirkey

mattkirkey
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 01 June 2006 - 08:16 PM

The $body contains HTML, CSS as well as PHP code. It mainly contains HTML.

When I tried to use eval ($body), I got a parse error...

Any other suggestions?
-Matt

[!--quoteo(post=379162:date=Jun 1 2006, 04:06 PM:name=nogray)--][div class=\'quotetop\']QUOTE(nogray @ Jun 1 2006, 04:06 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
instead of print ($body); use eval($body);

if php stored as a string, you need to use the eval function
[a href=\"http://us2.php.net/manual/en/function.eval.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.eval.php[/a]
[/quote]


#4 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 01 June 2006 - 10:40 PM

Well, I am not really sure if this is the best solution, but since you have php, html, javascript, and css all stored togather I don't think you can do anything else.

Try to write the $body content to a file, and than include that file in an include("new_file.php");

If the content of the body will change for different users and over time. You can delete the file when the page is done processing.

Good luck

NoGray.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users