Jump to content


Photo

Headers


  • Please log in to reply
6 replies to this topic

#1 ari_aaron

ari_aaron
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationToronto, Canada

Posted 07 May 2006 - 07:27 PM

how can I make HTML code from 1 file go into every one.
I need something like:

<html>
<head>
<title>Home</title>
</head>
<header.html>
<!---page content>
<footer.html>
</html>


also, it there a way to open tags in the other files, and close them in this file?

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 07 May 2006 - 07:51 PM

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]
Legend has it that reading the manual never killed anyone.
My site

#3 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 07 May 2006 - 07:54 PM

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.
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#4 ari_aaron

ari_aaron
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationToronto, Canada

Posted 07 May 2006 - 08:10 PM

The HTML inludes don't work on .php files. only .shtml

auto_prepend_file and auto_append_file arn't good because the title is diffrent on each page.

#5 Michael4172

Michael4172
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 07 May 2006 - 09:03 PM

Why not just use the php includes?

<?php include("somefile.php"); ?>


#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 07 May 2006 - 09:05 PM

[!--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) View Post[/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

<html>
<head>
<title>Home</title>
</head>
<?php include("header.html"); ?>
<!---page content>
<?php include("footer.html"); ?>
</html>

Legend has it that reading the manual never killed anyone.
My site

#7 ari_aaron

ari_aaron
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationToronto, Canada

Posted 07 May 2006 - 09:10 PM

this is a php forum....


anyway, thank you, that is what I needed.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users