Dynadot

[Resolved] Php and html noob question

Spaceship Spaceship
Watch
Impact
34
php and html noob question

Is available tu use this: "<?
require_once("footer.php");
?>" in html and if it is how? thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
jackdomain said:
Is available tu use this: "<?
require_once("footer.php");
?>" in html and if it is how? thanks
Sure! And put it anywhere you want. The file must be .php (not .html)
 
0
•••
but if i want to be it html?
 
0
•••
0
•••
In the directory you want to parse html files as PHP create (or append to an already existing) .htaccess file (thats ".htaccess" with the leading period)

with this
Code:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

Different Apache and php configs are different, if that doesn't work post your Apache, and PHP version #s.

-Jason
 
0
•••
jackdomain said:
Is available tu use this: "<?
require_once("footer.php");
?>" in html and if it is how? thanks

Html and php are 2 different things they will never go together, so Dont try to put php in html.
 
0
•••
domainstarz said:
Html and php are 2 different things they will never go together, so Dont try to put php in html.
You can instruct Apache to parse .html files as PHP, as DopeDomains pointed.
 
0
•••
just rename that original file as .php and it should start working
 
0
•••
contact the hosting admin to set up the server to use html-s like php files...or you can still use the .htaccess stated above
 
0
•••
thanks for all the answers. I tryied the most simple option (rename html to php) and it works. Thanks alot!
 
0
•••
talk about giving him the most difficult answers. He just wanted to include his footer html into every page so the html was only coded once.

Everyone's going on about modding your .htaccess and changing content type. :-/

What he really needed to know was that a php file is the same as a html page as in it can have html code in it. The only difference is that in a php file anything inside a <?php ?> tag will be parsed as php code.
 
0
•••
paaaaaaaaaa said:
What he really needed to know was that a php file is the same as a html page as in it can have html code in it. The only difference is that in a php file anything inside a <?php ?> tag will be parsed as php code.
You don't need to. As long as the file .html could not execute in host, it can not parse the PHP code. Or if he want he can make IFRAME for this code (need a bit more work)
D.
 
0
•••
If all you're gonna do is include a footer your could try using SSI.
 
0
•••
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back