FreeBenzine Posted August 21, 2010 Report Share Posted August 21, 2010 Hello, My page has several html includes. The index page with html does not work, and had to be made shtml to work. Now i need to include php inside a DIV of the shtml file. The include php works quite ok with html but fails with shtml. Could you kindly give me advice how to include php inside a DIV of shtml? Tim Quote Link to comment Share on other sites More sharing options...
Andrea Posted August 22, 2010 Report Share Posted August 22, 2010 If you include php, the page should be XXXXXX.php. Quote Link to comment Share on other sites More sharing options...
FreeBenzine Posted August 22, 2010 Author Report Share Posted August 22, 2010 Changing the file extension to xxx.php helps in invoking the php include but the html includes (e.g. the menu) do not work. Any solutions? Quote Link to comment Share on other sites More sharing options...
Andrea Posted August 22, 2010 Report Share Posted August 22, 2010 What do you mean 'html includes'? Can you show us what you have? A link would be idea, if there's not one, then paste the code here (all of it) Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 22, 2010 Report Share Posted August 22, 2010 One thing you could try -- assuming you are running a Linux based server, not Windows -- is to add a couple lines to your .htaccess file that tell the server to process .shtml files as PHP (which should allow you to keep the .shtml extension but still have the server process PHP) This has more info: http://www.kavoir.com/2009/01/php-run-html-as-php.html However, I'm not sure if there are any security related issues with doing this (though I don't think so?) and I'm not absolutely sure that .shtml includes will still work. If it doesn't work, you could always switch out .shtml includes for PHP includes instead. Quote Link to comment Share on other sites More sharing options...
FreeBenzine Posted August 22, 2010 Author Report Share Posted August 22, 2010 Hi, I have several DIV elements and I am mainly calling html includes inside the DIV elements. In some occasions I need to use php includes in some DIVs. Here is my index file, I hope that it is understandable. Comments will be welcome. The index file when saved as shtml works fine as long as there are only html includes. If I have php includes it does not work. Changing the extension to php allows the php include to work but the html includes do not work. Any suggestions will appreciated. Thanks in advance. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Go Global</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="GGStyleSheet.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <div id="TopTopDiv"> <!--#include virtual="IncludeTop.html" --> </div> <div id="LeftDiv"> <div id="LeftmenuDiv"> <!--#include virtual="IncludeLeftMenu.html" --> </div> <div id="BottomofMenuDiv"> <!--#include virtual="IncludeBottomofMenu.html" --> </div> </div> <div id="CentralDiv"> <?php include("test.php"); ?> </div> <div id="RightDiv"> <!--#include virtual="IncludeRight.html" --> </div> <div id="FooterDiv"> <!--#include virtual="IncludeFooter.html" --> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Wickham Posted August 22, 2010 Report Share Posted August 22, 2010 You will have to change th efilename extension from .shtml if you want the PHP "includes" to work. Either change the filename or change it by using .htaccess file as falkencreative suggested. Then any shtml code won't work as you will be mixing shtml and php so you need to use one or the other. Quote Link to comment Share on other sites More sharing options...
administrator Posted August 23, 2010 Report Share Posted August 23, 2010 Then any shtml code won't work as you will be mixing shtml and php so you need to use one or the other. Go with PHP as you will many more options in terms of what you could do with that page. SHTML is a throwback to an earlier time in the Web ... kinda like phone operators. ... No longer needed. Stefan Quote Link to comment Share on other sites More sharing options...
FreeBenzine Posted August 23, 2010 Author Report Share Posted August 23, 2010 Thanks a lot everyone for the support, getting addicted this site. I'm moving ahead with php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.