This is what i know:

if u have a .php file, u can use include to pull in other files. no problem there.

This is what i need to know:

how to use html coding to pull in a .php file into the page and display it.

    only way would be to either use an iframe to load the page, or to use javascript tags with the src pointing to the url of the php file. but if you do the javascript way all output in the php script would have to be done with javascripts document.write.

    remember, php is a programming language, whose code is all executed server side before any data is sent to the users browser, and html is just a markup language that has no fancy features for performing any actions.

      if you rserver supports in you might look into ssi's. remember though, the php wont be executed.

        cool cool.

        naw i need this thing to execute.

        herez what i tryin to achieve, i got a script that posts html code to a .php file.. of course html is displayed properly.. but i tried to post a piece of php code to include a file, and it out showed up in the output html markup, did not display (include) the file.

        so drew, u sayin i need javascript code to actually openout my .php file and writeout the codes i need right?

          OK, so what I think you mean is that your are trying to parse PHP code inside a file with an html extension and finding that it doesn't work?

          If I have interpreted correctly, this is how you do it if your server is Apache?

          find the line...
          AddType application/x-httpd-php .php .php3

          and append a couple things...
          AddType application/x-httpd-php .php .php3 .html .htm

          By the way, I translated this through gizoogle so you'd be able to understand our posts 😃

            no no.. haha.. ok, i jus found out some more info.. let me help u help me:

            ok, the posting script saves the post in a mysql db. Index.php connects to it and displays the post. if i post html.. index.php will display the html properly.. no problems. when i post the php <?include(file)?> code.. it only shows up in the source of the page, does not execute.

            of course drew jus informed me that php files are executed on server side before user browser. SOO i thought maybe i could post the javascript code to open index.php and write the php <?include(file)?> code there.

            and i also found out, there is a security issuse with opening a file and trying to write code in it using javascript.write function. - can someone confirm this?

            i alsooooo saw something about using a cookie to temp store data..not very clear about this.

              and now wid more browsin.. i find all this was a waste of typin.. javascript cant do crap wid server files.. need sum asp or other frikkin language i hav no blasted idea bout. thanks for the replys though.

                You might try matching PHP delimiters (<??>) via preg_match and parse the PHP script with eval. It would be a little more than trivial (matching php blocks over mulitple lines--/pattern/Ua--and putting the php output in the proper place...and escaping the PHP code properly.)

                  I would imagine that you could either

                  1. use file() to load the file into a var. Then you could just echo the contents of this file between a pair of <pre> </pre> tags.

                  2. use an fopen(), fread(), fclose() loop tp read each line and echo it.

                  Remember you don't have to worry about the PHP getting interpreted now, because the PHP code will be output from the PHP interpreter rather input to it.

                    Write a Reply...