3 Replies - 474 Views - Last Post: 29 November 2009 - 12:42 PM Rate Topic: -----

#1 szlykz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 26-November 09

SSI and PHP

Post icon  Posted 29 November 2009 - 11:56 AM

I have a html page that's called by a php page. Can I use the SSI include in the html page?
My results.php file has the following code:
include "results.html";

My results.html file has the following code:
<!--#include virtual="nav_bar.html" -->

This does not seem to call the file. Since PHP is working on the server side shouldn't the SSI include work also?
Thanks for any assistance you can give me.

Is This A Good Question/Topic? 0
  • +

Replies To: SSI and PHP

#2 s-grind  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 86
  • Joined: 20-November 09

Re: SSI and PHP

Posted 29 November 2009 - 12:07 PM

View Postszlykz, on 29 Nov, 2009 - 10:56 AM, said:

I have a html page that's called by a php page. Can I use the SSI include in the html page?
My results.php file has the following code:
include "results.html";

My results.html file has the following code:
<!--#include virtual="nav_bar.html" -->

This does not seem to call the file. Since PHP is working on the server side shouldn't the SSI include work also?
Thanks for any assistance you can give me.


To see if SSI works, just copy the next code to an new HTML page and save it as .html.
If nothing hapens, try save it as .shtml. If there's nothing happening again; SSI won't work on your server.

<HTML>
<TITLE>Test File</TITLE>

<!--#config timefmt="%A" --> <!--#echo var="DATE_LOCAL" -->

</HTML>


Was This Post Helpful? 0
  • +
  • -

#3 szlykz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 26-November 09

Re: SSI and PHP

Posted 29 November 2009 - 12:12 PM

View Posts-grind, on 29 Nov, 2009 - 11:07 AM, said:

View Postszlykz, on 29 Nov, 2009 - 10:56 AM, said:

I have a html page that's called by a php page. Can I use the SSI include in the html page?
My results.php file has the following code:
include "results.html";

My results.html file has the following code:
<!--#include virtual="nav_bar.html" -->

This does not seem to call the file. Since PHP is working on the server side shouldn't the SSI include work also?
Thanks for any assistance you can give me.


To see if SSI works, just copy the next code to an new HTML page and save it as .html.
If nothing hapens, try save it as .shtml. If there's nothing happening again; SSI won't work on your server.

<HTML>
<TITLE>Test File</TITLE>

<!--#config timefmt="%A" --> <!--#echo var="DATE_LOCAL" -->

</HTML>


Thanks for your help. I know that SSI works because it's working on the rest of my html pages. It just doesn't seem to work on pages called by PHP.
Was This Post Helpful? 0
  • +
  • -

#4 AdaHacker  Icon User is offline

  • Resident Curmudgeon

Reputation: 452
  • View blog
  • Posts: 811
  • Joined: 17-June 08

Re: SSI and PHP

Posted 29 November 2009 - 12:42 PM

View Postszlykz, on 29 Nov, 2009 - 01:12 PM, said:

Thanks for your help. I know that SSI works because it's working on the rest of my html pages. It just doesn't seem to work on pages called by PHP.

That's because PHP doesn't speak SSI. When you include a file though PHP, it is only interpreted by PHP - it doesn't get run through the web server's SSI processor. The easiest solution, assuming that URL includes are turned on in your PHP configuration, would be to include the URL to your file, like this:
include "http://yourdomain.com/path/to/results.html";

That will cause PHP to make an HTTP request to get the file contents, so the web server should run the SSI processing normally. Of course, I wouldn't vouch for the performance of this solution...I'm just saying it's easy to implement. A better solution would probably be to just convert your include file from SSI to PHP and use that instead.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1