The Most Active and Friendliest
Affiliate Marketing Community Online!

“AdsEmpire”/  Direct Affiliate

parse 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.
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.


from the reading i did last night it seems you use

For web servers using PHP as apache module:
HTML:
AddType application/x-httpd-php .html .htm
For web servers running PHP as CGI:
HTML:
AddHandler application/x-httpd-php .html .htm
Both these seem to deal with php which is included in a .html page

So i have my exisiting .html pages, which ive added php includes to.
When you view the .html pages normally and in the source code their is no sign of php as OWG mentions on other thread - really clever to someone who knows little about php.

I will update this thread rather than both. Thanks again Bagi.
 
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)
 
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)


Thanks for your comments.
Every page is going to have php includes in, as menu was on every page which is what am working through now!!

Hopefully load times wont be too much extended as on my brothers server - which is far from overloaded.

It seems there are cons to this method but the pros of search engines actually being able to see links now should outweigh them i reckon.
 
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).
 
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).


it is not a very technical approach i know, though seems to be loading fine by just looking!!! so visitors will probably not see a noticeable difference.



Do i need to included the 3 php files in every directory on my domain. - i have done

for eg mydomain.co.uk/counties/ - 3 php with counties folder
mydomain.co.uk/directory/ - 3 php files in directory folder

The whole site is now running with php includes apart from blog.

have a look if you can see any problems comments would be appreciated.
 
Last edited by a moderator:
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
 
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

ok here we go i will try to explain better.........

i have used followingf in correct places on my .html pages
<?php include "leftmenu.php"; ?>
<?php include "rightmenu.php"; ?>
<?php include "footer.php"; ?>

written each of php files with my menu system in.

I have added the 3 php files in each of folders i have for my site ie

mydomain.co.uk/
mydomain.co.uk/directories/
mydomain.co.uk/counties/

as without adding them the pages in directory wouldnt load the menus.

ooooooooooo i have just worked it out i think!!!!!:thumbsup:
for .html files in directories ie mydomain.co.uk/counties/

do i need to change the php includes to read for eg

<?php include "../footer.php"; ?>

and leave the php files in domain.co.uk/

If so looks like am need to edit 50 pages!!! find and replace is such a blessing!!!

I am new to this though loving learning it, can sometimes be a bit slow.

Thanks all for help.
 
Last edited by a moderator:
<?php include "../footer.php"; ?> that would work in the same way :) 50 pages... well... welcome to the repetitive side of programming lol
 
<?php include "../footer.php"; ?> that would work in the same way :) 50 pages... well... welcome to the repetitive side of programming lol


o am good for donkey work!!!

if i created a folder mydomain.co.uk/php and put php files in there

would the include just be <?php include "../php/footer.php"; ?>

for every .html page.

Which is best way to do it, want to get it right and put to rest!!!
 
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.
 
glad it works.

consider using more shorthand and foolproof includes like:
HTML:
<div id="sidemenu">
<?=include_once("./inc/leftmenu.inc")?>
</div>
...

of course, having file includes is deemed acceptable but there is the thing: each page view spawns threads and file handles that open other files and so forth. i have adopted a different approach (not exactly MVC but good anyway):

say, you do at top of your page:

<?PHP

include_once("./inc/site_functions.inc");

// now start html or whatever.

?>

within the site functions.inc i can define things such as (pseudo):
PHP:
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
}

which i can then use as

HTML:
<div id="leftmenu">
<?=sideMenu($_SERVER['PHP_SELF'], "left")?>
</div>

etc etc.
 
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.

thanks Chris, so off we go with <?php include "../php/footer.php"; ?> :thumbsup:
 
Done !!!!!!

seems to be working great!!!!

Big thanks to OWG who came up with the idea and all those that have guided me through it. Would of been lost without it, little suprised ive done it and really pleased it is now 'google friendly;:goodjobsign:

At the risk of being shot:2guns:

The pages had basically very few links, just internal links within the content of each page. Now that i have released all these links onto my site what kind of effect do you think will be seen in SERPs, short term and long term. Anyone venture to guess??

Before i had maybe 4-5 links per inner page, now i have about 60-70 !!!

For the time being i have made the 30-40 regional page links, privacy etc no follow on each page, scared of diluting my ranking with too many links? they are indexed already. Good idea?
 
banners
Back