NameSilo

[Resolved] Php and html noob question

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

jackdomain

Established Member
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
but if i want to be it html?
 
0
Close
0
Close
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
Close
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
Close
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
Close
just rename that original file as .php and it should start working
 
0
Close
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
Close
thanks for all the answers. I tryied the most simple option (rename html to php) and it works. Thanks alot!
 
0
Close
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
Close
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
Close
If all you're gonna do is include a footer your could try using SSI.
 
0
Close
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back