ari_aaron Posted May 7, 2006 Share Posted May 7, 2006 how can I make HTML code from 1 file go into every one.I need something like:[code]<html><head><title>Home</title></head><header.html><!---page content><footer.html></html>[/code]also, it there a way to open tags in the other files, and close them in this file? Link to comment https://forums.phpfreaks.com/topic/9259-headers/ Share on other sites More sharing options...
AndyB Posted May 7, 2006 Share Posted May 7, 2006 Use html includes - you don't need php at all. Excellent tutorial at [a href=\"http://bignosebird.com/ssi.shtml\" target=\"_blank\"]http://bignosebird.com/ssi.shtml[/a] Link to comment https://forums.phpfreaks.com/topic/9259-headers/#findComment-34117 Share on other sites More sharing options...
neylitalo Posted May 7, 2006 Share Posted May 7, 2006 If your server has PHP installed on it, you can use the auto_prepend_file and auto_append_file directives in .htaccess. Just put the top half (everything above the body content) in the auto_prepend_file directive, and everything below the body content in the auto_append_file directive. It'll automatically put the contents of those files at the top and bottom, respectively, of all PHP scripts. Link to comment https://forums.phpfreaks.com/topic/9259-headers/#findComment-34119 Share on other sites More sharing options...
ari_aaron Posted May 7, 2006 Author Share Posted May 7, 2006 The HTML inludes don't work on .php files. only .shtmlauto_prepend_file and auto_append_file arn't good because the title is diffrent on each page. Link to comment https://forums.phpfreaks.com/topic/9259-headers/#findComment-34122 Share on other sites More sharing options...
Michael4172 Posted May 7, 2006 Share Posted May 7, 2006 Why not just use the php includes?[code]<?php include("somefile.php"); ?>[/code] Link to comment https://forums.phpfreaks.com/topic/9259-headers/#findComment-34131 Share on other sites More sharing options...
AndyB Posted May 7, 2006 Share Posted May 7, 2006 [!--quoteo(post=372102:date=May 7 2006, 04:10 PM:name=ari_aaron)--][div class=\'quotetop\']QUOTE(ari_aaron @ May 7 2006, 04:10 PM) [snapback]372102[/snapback][/div][div class=\'quotemain\'][!--quotec--]The HTML inludes don't work on .php files. only .shtml[/quote]If you had mentioned that ...Then use php includes: example[code]<html><head><title>Home</title></head><?php include("header.html"); ?><!---page content><?php include("footer.html"); ?></html>[/code] Link to comment https://forums.phpfreaks.com/topic/9259-headers/#findComment-34133 Share on other sites More sharing options...
ari_aaron Posted May 7, 2006 Author Share Posted May 7, 2006 this is a php forum....anyway, thank you, that is what I needed. Link to comment https://forums.phpfreaks.com/topic/9259-headers/#findComment-34135 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.