Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to Include PHP script in shtml file ???

Thread Tools

How to Include PHP script in shtml file ???

Michael Winter
Posts: n/a
On 27/10/2005 23:38, EnjoyNews wrote:


> I thought maybe some javascript in my .html file could execute
> another file, in this case a .php file. [...]

It could, but it's not a good solution. One of the advantages of using
the server is that you can reliably perform actions using it. Using a
client-side script negates this reliability and, let's face it, the
reason why you're looking for a quick way out is because you're not
inclined to make the necessary effort to solve the problem properly.

>> What's a .shtml site, anyway?

> it's a .html file that uses serverside commands like "include file"

I'm well aware of SSI. You missed my point, but it's not important.


> It's rather complicated to rename the files from .shtml to .php,
> since all the serverside commands used in the files, does not work in
> an .php file.

With your server configuration, yes. However, it strikes me as rather
odd that you didn't forsee this issue.


> But how do I get the server to pass .shtml file through PHP. ??

I'm curious to know why it doesn't anyway. An SSI include element should
pass a PHP script through the preprocessor. The URL for the virtual
attribute value (typically preferred over file) can even include a query
string that can be accessed as usual.

If the server is configured with IncludesNOEXEC, rather than Includes,
then an error will result because permission to execute the script was
not granted, but you made no mention of that.


Michael Winter
Prefix subject with [News] before replying by e-mail.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
Ruby equivalence for php include("file.php"); Miquel Oliete Ruby 4 03-07-2008 06:33 PM
converting .shtml to .php Man in Yellow Hat NZ Computing 2 12-25-2004 05:31 AM