Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2004-06-23, 07:54 AM   #1
sttvsttv
WHO IS FONZY!?! Don't they teach you anything at school?
 
Join Date: May 2004
Location: Norway
Posts: 48
How to add header and footer with .htaccess

Help, i need to use .htaccess to inser headers and footers.
Anyone here that know the code to insert?

Stein
sttvsttv is offline   Reply With Quote
Old 2004-06-23, 08:18 AM   #2
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
I use php or ssi to add headers and footers not htaccess.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-23, 12:27 PM   #3
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
The Apache module is called mod_layout.
swedguy is offline   Reply With Quote
Old 2004-06-23, 12:33 PM   #4
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
That is what I love about this business, always something new to learn.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-23, 01:19 PM   #5
sttvsttv
WHO IS FONZY!?! Don't they teach you anything at school?
 
Join Date: May 2004
Location: Norway
Posts: 48
Hmm i dont know shit about php and ssi.

tried an acces file with
Header Add Name header.html
Footer Add Name footer.html

And got an 500 error.

I still have much to learn

Stein
sttvsttv is offline   Reply With Quote
Old 2004-06-25, 11:06 PM   #6
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
PHP seems the simplest way. Construct your html pages as you normally would but name each one whatever.php instead of whatever.html. On each php page, you'll place an include tag on top for your header like this:
<?php
include("header.html");
?>
At the bottom, where you want your footer to be, you'll place this:
<?php
include("footer.html");
?>
Obviously, you'll need to build your header.html and footer.html pages.

So, whatever.php could look something like this:
<?php
include("header.html");
?>
<table><tr><td>All the wacky porn shit you want on your page.
</td></td></table>
<?php
include("footer.html");
?>

Play with this a bit and you will get hooked on it. You'll find yourself building pages that are almost all include tags, pulling in info from other php and html source pages. As long as you use the .php extension you can use the php include tags. Otherwise, it can all be html code.
Keep in mind, you have to test these php pages online, unless you have PHP on your home system.
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2004-06-26, 02:37 AM   #7
sttvsttv
WHO IS FONZY!?! Don't they teach you anything at school?
 
Join Date: May 2004
Location: Norway
Posts: 48
Thanks for the useful info Useless Warrior


i will try out that one.

Stein
sttvsttv is offline   Reply With Quote
Old 2004-06-27, 01:55 PM   #8
Jason
A woman is like beer. They look good, they smell good, and you'd step over your own mother just to get one!
 
Join Date: Sep 2003
Location: Seattle, WA
Posts: 58
Send a message via ICQ to Jason
while useless warrior's way is certainly easy, mod_layout is the easiest of all ways to go because you don't have to alter your page code at all.

http://tangent.org/index.pl?lastnode_id=478&node_id=362

just have your admin add the module to your apache, it's generally not there by default.

-jason
Jason is offline   Reply With Quote
Old 2004-06-28, 10:12 AM   #9
AcidMaX
Programming till my fingers bleed.
 
AcidMaX's Avatar
 
Join Date: Aug 2003
Location: Michigan
Posts: 876
There are many ways to do it.

If you are using php (ie., php extensions or html is configured to be parse by php) you could use the following in an htaccess.

php_value auto_prepend_file "/path/to/header.php";
php_value auto_append_file "/path/to/footer.php";

That will put those files at the top and bottom of each php file or any file configured to be parsed by php.

If you are looking for other ways, SSI might be an option for you otherwise you would need some scripting experience or one of the apache modules these other fine folks talked about.

Andy
AcidMaX is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:19 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc