include() at the very bottom
Moderator: General Moderators
include() at the very bottom
How would I go about getting a page with include to appear at the very bottom of the page it is include() in? Tables, or is there an easier way?
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
-
AbelaJohnB
- Forum Newbie
- Posts: 9
- Joined: Sat Feb 28, 2004 12:14 am
So, I'm guessing your just wanting to know how to include a "footer" file on every page of your website, right (??)
If so, here's how.
You've got two (or a bazillion) files:
File One: index.php
That's your main file, or any other file on your website. Just make sure those last seven (7) lines of code are at the very bottom of ever page (or before </BODY></HTML> depending on how you care to do it.
Than for our global "footer" file, you simply create a second file. We'll call it: footer.php
And that's all it really takes.
You'll notice I use [php_man]include_once()[/php_man] and not [php_man]include()[/php_man] because you only want your footer file to load once on any given php file.
And, if this is totally not what you want.... well, I tried.
If so, here's how.
You've got two (or a bazillion) files:
File One: index.php
Code: Select all
<HTML>
<HEAD>
<TITLE> index.php </TITLE>
</HEAD>
<BODY>
This is our main file.
<BR /><BR />
<?php
///////////////////////////////////////////////////////
// INCLUDE FOOTER FILE
///////////////////////////////////////////////////////
include_once("/path/to_my/footer.php");
//
?>Than for our global "footer" file, you simply create a second file. We'll call it: footer.php
Code: Select all
Copyright &copy; Your Name. 2000-<?= date('Y');?> All Rights Reserved.
</BODY>
</HTML>And that's all it really takes.
You'll notice I use [php_man]include_once()[/php_man] and not [php_man]include()[/php_man] because you only want your footer file to load once on any given php file.
And, if this is totally not what you want.... well, I tried.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- Pointybeard
- Forum Commoner
- Posts: 71
- Joined: Wed Sep 03, 2003 7:23 pm
- Location: Brisbane, AUS
- Contact:
You mean at the absolute bottom of the page? You can do that sort of thing with CSS heres a link that might help you. AListApart - Exploring Footers Hope that helps
-PB
-PB
Just playin around with stuff... getting vars and stuff down, so don't laugh
-S
Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
#
#--------- Form deleted for space
#
if(!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['comments'])){
$name=$_POST['name'];
$address=$_POST['email'];
$comments=$_POST['comments'];
echo ("<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="5%"><div align="center">
<td width="50%" bgcolor='#EFEFEF'>
<i>This is the information you submitted:</i><br><br>
Name: $name<br>
Email: <a href='mailto:$address'>$address</a><br>
Comments: $comments<br><br>
<div align='center'><font size="1">If you would like to see the entire guestbook, click <a href='guestbook.php'>here</a>.</div>
</td>
<td width="25%">
</td>
</div>
</td>
</tr>
</table>");
}else{
echo "<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
Fill it out man.
</div>
</td>
</tr>
</table>
";
}
include("footer.php");
#
#-- Getting this at the absolute bottom of the page, regardless of browser size, is what I am after. Right now it is at the bottom of the form.
#
?>
</body>
</html>- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
<?php
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
#
#--------- Form deleted for space
#
if(!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['comments'])){
$name=$_POST['name'];
$address=$_POST['email'];
$comments=$_POST['comments'];
echo ("<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="5%"><div align="center">
<td width="50%" bgcolor='#EFEFEF'>
<i>This is the information you submitted:</i><br><br>
Name: $name<br>
Email: <a href='mailto:$address'>$address</a><br>
Comments: $comments<br><br>
<div align='center'><font size="1">If you would like to see the entire guestbook, click <a href='guestbook.php'>here</a>.</div>
</td>
<td width="25%">
</td>
</div>
</td>
</tr>
</table>");
}else{
echo "<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
Fill it out man.
</div>
</td>
</tr>
</table>
";
}
<table height=100%>
<tr><td></td></tr>
</table>
include("footer.php");
#
#-- Getting this at the absolute bottom of the page, regardless of browser size, is what I am after. Right now it is at the bottom of the form.
#
?>
This should do the trick
</body>
</html>
?>- Pointybeard
- Forum Commoner
- Posts: 71
- Joined: Wed Sep 03, 2003 7:23 pm
- Location: Brisbane, AUS
- Contact:
*cries at the use of a table for page formatting*
Steveo31, start good practises now and use XHTML and CSS.
Steveo31, start good practises now and use XHTML and CSS.