As per this thread anyone know how to parse php to .html in .htaccess.
Any help appreciated, thanks.
Any help appreciated, thanks.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: this_feature_currently_requires_accessing_site_using_safari
Something like "AddType application/x-httpd-php .html" ?
ChrisB.
AddHandler application/x-httpd-php .html
When the AddType does not work you need to test as AddHandler. As far as I know depending on the php setting the two variant may make the Apache parse html as php.
AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm
of course there won't be any sign of PHP when you view source - if the application type handler works and pre-processing .html goes through the php binary / lib - it means it's working as it should.
it's always good to be able to use inline php from a .html file, but! using this application handler has a knock on effect on performance - serving a straight html file is considerably faster than a php file insofar as apache is concerned. enable this feature on a busy server with a lot of .html files and you may see your load times skyrocket... considering that most of your .html files won't have any php in them (probably), invoking the compiler to serve them is wasteful but not uncommon (even VBB supports .html or .php extension for the distribution)
What Dimitar wrote is pretty true regarding the speed, otherwise I suppose the php has more advantages due to the includes (can change the footer/header/menu within seconds), than disadvantage (slower speed).
im not sure if im on the right track here... but if i understand correctly...
your asking should i put the 3 php files in every directory... if thats the case no!
what you should do is make a folder out of the public_html or wwwroot.. and then do a full path include rather than relative to the folder you are in.
include_once('/home/accountname/myphpfiles/file.php');
hope i understood the question correctly.... and btw for a non technical person im impressed with what you have done
<div id="side">
<?=include_once("./leftmenu.php")?>
</div>
<?php include "../footer.php"; ?> that would work in the same way50 pages... well... welcome to the repetitive side of programming lol
<div id="sidemenu">
<?=include_once("./inc/leftmenu.inc")?>
</div>
...
function sideMenu($where, $what) {
// read things from a db or whatever under whatever criteria, contextual menus or whatever parameters - use your imagination
// output data or return as a string
}
<div id="leftmenu">
<?=sideMenu($_SERVER['PHP_SELF'], "left")?>
</div>
If you can put them outside of the document root it might save any issues you might have with exposed code in the future if the html files are shown without the PHP being parsed.
ChrisB.