Dec 10th, 2008 09:33
Taksh Verdhan, healthy man, dman, forum net tr, yrt e, Christopher Bachmann,
PHP is a server side scripting language and PHP scripts need to be
side (browser) language and does not require the server to parse the
file before it is sent to the browser.
You can do this with "exec cgi" in sHTML files, but the problems with
this are described at:
You can, however, use PHP to generate code which you use in a client
side script tag. Add the following to your html file:
Then make a PHP script on your server (must have PHP installed):
<? print "alert('hey !');\n"; ?>
and then load the HTML file, you should see the alert box. You have
just used PHP to generate text for a client-side include.
There is apparently a way to do this in Mozilla 1 / Netscape 7 using
<object> tag which is described at:
This seems to sort of do what you want it to, the syntax for this
<object type="text/html" data="http://url.org/script.php"></object>
Which I found does work in Mozilla 1 (rc2).
The other workaround is to use frames.
However, what you are probably asking is if you can use PHP like an
shtml include where anything the PHP script generates is assembled
inline with any HTML you have around it. The answer is "not really".
Basic HTML does not have any standard for handling includes. This is a
limitation with the HTML 4.0 spec and has little to do with PHP.