0

I'd like to include a .shtml file in a .php page. I know it is possible, as i have done it before (though i've forgotten the code). Please can someone help?

dmck
  • 7,801
  • 7
  • 43
  • 79
Aqr Aqr
  • 11
  • 7

2 Answers2

2

I would suggest using:

include_once('/includes/header.shtml');
Avishai
  • 15
  • 2
0

Did you try :

 echo file_get_contents('/includes/header.shtml');
 // or
 echo file_get_contents('includes/header.shtml');

It might work.

But I would just start converting all the templates to any of available php templating engines.

E_p
  • 3,136
  • 16
  • 28
  • What is your folder structure. – E_p Nov 27 '12 at 21:44
  • 1
    Can us tell what is your folder layout. As `'/include/header.shtml'` does not seam right – E_p Nov 27 '12 at 22:00
  • /includes/header.shtml is correct since the folder "includes" is in the top-level of the domain and the shtml file is within it. the test.php file is in a folder also in the top-level of the domain. – Aqr Aqr Nov 27 '12 at 22:03
  • Based on your last comment I was right. You need `echo file_get_contents('includes/header.shtml');` or even just `require 'includes/header.shtml';` would work. Just try it. – E_p Nov 27 '12 at 22:12
  • i have used: and know test.php is displaying a blank page. – Aqr Aqr Nov 27 '12 at 22:17
  • I've found out it only works when specifying an absolute url, e.g. `echo file_get_contents('http://sitename.com/file.shtml');`. Otherwise, the SSI will not parse and remain HTML comments. – mnsth Mar 03 '15 at 13:19