Page 1 of 1

include() at the very bottom

Posted: Fri Feb 27, 2004 9:32 pm
by Steveo31
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?

Posted: Fri Feb 27, 2004 9:45 pm
by Illusionist
i dont quite understand your question, but i think your asking is there a way to include like a footer at the bottom of your page? Well, yes, jsut use include(). You can use Include() any where on your PHP page and it will include that file!

Posted: Fri Feb 27, 2004 10:35 pm
by Steveo31
Yep. Got that far :)

I guess what I am asking more specifically is to have the contents of that footer.php to be at the bottom of the page it is included in. Maybe have a table at the absolute very bottom of the page, and include() it there.

-S

Posted: Sat Feb 28, 2004 12:42 am
by AbelaJohnB
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

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");
//
?>
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

Code: Select all

Copyright &amp;copy; Your Name. 2000-&lt;?= date('Y');?&gt; All Rights Reserved.

&lt;/BODY&gt;
&lt;/HTML&gt;

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. ;)

Posted: Sat Feb 28, 2004 3:28 pm
by Steveo31
Hah... no, but thanks. I have the footer being included no problem. What I am asking is how to position the contents of that page at the bottom of the page it is called into.

Posted: Sat Feb 28, 2004 3:41 pm
by John Cartwright
Put it @ the bottom of your code....

Show us what you got so far...

Posted: Sat Feb 28, 2004 6:03 pm
by Pointybeard
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

Posted: Sat Feb 28, 2004 6:04 pm
by Steveo31
Just playin around with stuff... getting vars and stuff down, so don't laugh ;)

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%">
				&nbsp;
				</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>
-S

Posted: Sat Feb 28, 2004 6:23 pm
by John Cartwright

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> 
?>

Posted: Sat Feb 28, 2004 6:31 pm
by Pointybeard
*cries at the use of a table for page formatting*

Steveo31, start good practises now and use XHTML and CSS. :)

Posted: Sat Feb 28, 2004 6:52 pm
by Steveo31
TY Phenom... I'll give it a try.


PB- Thanks for the tears, and the links. This is the way I learned, I guess there is an easier way. :)