PDA

View Full Version : Header/Footer


Craig Antill
Sat 23rd Sep '00, 4:19pm
OK, OK, I give up! I've searched through the forums, and spent a good couple hours this evening trying to get this to work, but I need some help if you would :)

What I want to do is to include external text files in the headers and footers, along with HTML and PHP snippets - such as this:

Header:
header_upper.ssi
PHP code
header_lower.ssi

Footer:

footer_upper.ssi
PHP code
footer_lower.ssi
HTML code

Can anyone offer advice ? Thanks :)

Mike Sullivan
Sat 23rd Sep '00, 4:34pm
Turn on PHP code parsing and try something like this:

$header = join("\n", file("/path/to/header_upper.ssi"));
//PHP Code here
//$header .= "blah"; //make sure you assign the stuff to $header and use .=
$header .= join("\n", file("/path/to/header_lower.ssi"));

And the footer...

$footer = join("\n", file("/path/to/footer_upper.ssi"));
//PHP stuff
$footer .= join("\n", file("/path/to/footer_lower.ssi"));
//HTML below, must be assigned to $footer; make sure you escape what you have to
$footer .= "<P>my html code";

Craig Antill
Sat 23rd Sep '00, 5:33pm
Brilliant!

Many thanks for your help - you sound like you've done that before :)

I am delighted to say that you saved me several more hours messing around not knowing what the hell I was doing! :)

Mike Sullivan
Sat 23rd Sep '00, 7:18pm
Actually, it has been asked before... :)

So I take it that that worked? Because I know some people have had some problems with PHP parsing.

Craig Antill
Mon 25th Sep '00, 1:19pm
It's been asked before ? Bloody hell! I need some lessons in how to use the search engine - i'm buggered if I could find it! :)

Yep - it worked flawlessly - thanks! :) I now have a random number generator so that my banners rotate properly, and the header/footers are pulled from an external file so that I no longer have to remember to make changes in the control panel each time I alter the standard header/footer files on the rest of the site :)

TechTalk
Thu 28th Sep '00, 7:55pm
I am still trying to get the whole header / footer working myself, but to no avail :(

Maybe someone can help?

What I have:
header.inc.php - I use this file on all my pages by doing a simple include(); and I would like to know how to call it from the vb header.

Here is the code:

<center>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" rowspan="2"><img src="http://www.glidetech.com/images/logo.jpg" width="150" height="86"></td>
<td width="615" align="center">
<table width="90%%" border="0" cellspacing="0" cellpadding="4">
<tr bgcolor="#CCCCCC" valign="middle">
<td>
<script language="JavaScript" src="../mmyhp/mmyhp.js"></script>
<a href="javascript:SetHomePage('www.glidetech.com', '/mmyhp', '')" target="_self">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>Set
Homepage</b></font></a><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
| <a href="javascript:addbookmark()"><b>Add Bookmark</b></a> | <a href="mailto:support@glidetech.com"><b>Contact
Us</b></a> | <b><a href="../forums/member.php?action=signup">Sign
up!</a></b> |</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="615">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td> <!-- Begin Banner Display -->
<?php
view("", 0, "_blank", "Main");
?>
<!-- End Banner Display --> </td>
</tr>
</table>
</td>
</tr>
</table>


And right underneath it I would like to include another file. navbuttons.inc.php. Again, I will need to know how to include this in the header because at this point it is not an option to modify the include file itsself . Here is the code for that one:

<table width="757" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="149">

<!-- Begin "home" button -->
<table width="149" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" bgcolor="<?php if ($sect=="home"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/lside.gif" width="7" height="21"></td>
<td bgcolor="#000000" height="2"><img src="../images/spacer.gif" width="2" height="2"></td>
<td valign="top" align="right" bgcolor="<?php if ($sect=="home"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/rside.gif" width="7" height="21" border="0"></td>
</tr>
<tr>
<td bgcolor="<?php if ($sect=="home"){echo "#FF9966";}else{echo"#6699CC";}?>" width="100%" height="19" align="center" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><a href="http://www.glidetech.com/_index.php" class="navbuttons"><b>Home</b></a></font></td>
</tr>
</table>
<!-- End "home" button -->

</td>
<td width="3"><img src="../images/spacer.gif" width="3" height="3">
</td>
<td width="149">

<!-- Begin "news" button -->
<table width="149" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" bgcolor="<?php if ($sect=="news"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/lside.gif" width="7" height="21"></td>
<td bgcolor="#000000" height="2"><img src="../images/spacer.gif" width="2" height="2"></td>
<td valign="top" align="right" bgcolor="<?php if ($sect=="news"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/rside.gif" width="7" height="21" border="0"></td>
</tr>
<tr>
<td bgcolor="<?php if ($sect=="news"){echo "#FF9966";}else{echo"#6699CC";}?>" width="100%" height="19" align="center" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><a href="http://www.glidetech.com/news/" class="navbuttons"><b>Tech. News</b></a></font></td>
</tr>
</table>
<!-- End "news" button -->

</td>
<td width="3"><img src="../images/spacer.gif" width="3" height="3">
</td>
<td width="149">

<!-- Begin "humor" button -->
<table width="149" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" bgcolor="<?php if ($sect=="humor"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/lside.gif" width="7" height="21"></td>
<td bgcolor="#000000" height="2"><img src="../images/spacer.gif" width="2" height="2"></td>
<td valign="top" align="right" bgcolor="<?php if ($sect=="humor"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/rside.gif" width="7" height="21" border="0"></td>
</tr>
<tr>
<td bgcolor="<?php if ($sect=="humor"){echo "#FF9966";}else{echo"#6699CC";}?>" width="100%" height="19" align="center" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><a href="http://www.glidetech.com/humor/" class="navbuttons"><b>Tech. Humor</b></a></font></td>
</tr>
</table>
<!-- End "humor" button --></td>

<td width="3"><img src="../images/spacer.gif" width="3" height="3">
</td>
<td width="149">

<!-- Begin "message boards" button -->
<table width="149" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" bgcolor="<?php if ($sect=="forums"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/lside.gif" width="7" height="21"></td>
<td bgcolor="#000000" height="2"><img src="../images/spacer.gif" width="2" height="2"></td>
<td valign="top" align="right" bgcolor="<?php if ($sect=="forums"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/rside.gif" width="7" height="21" border="0"></td>
</tr>
<tr>
<td bgcolor="<?php if ($sect=="forums"){echo "#FF9966";}else{echo"#6699CC";}?>" width="100%" height="19" align="center" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><a href="http://www.glidetech.com/forums/" class="navbuttons"><b>Message Boards</b></a></font></td>
</tr>
</table>
<!-- End "message boards" button -->
</td>

<td width="3"><img src="../images/spacer.gif" width="3" height="3">
</td>
<td width="149">

<!-- Begin "resources" button -->
<table width="149" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" bgcolor="<?php if ($sect=="resources"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/lside.gif" width="7" height="21"></td>
<td bgcolor="#000000" height="2"><img src="../images/spacer.gif" width="2" height="2"></td>
<td valign="top" align="right" bgcolor="<?php if ($sect=="resources"){echo "#FF9966";}else{echo"#6699CC";}?>" rowspan="2" width="7"><img src="../images/rside.gif" width="7" height="21" border="0"></td>
</tr>
<tr>
<td bgcolor="<?php if ($sect=="resources"){echo "#FF9966";}else{echo"#6699CC";}?>" width="100%" height="19" align="center" nowrap><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><a href="http://www.glidetech.com/resources/" class="navbuttons"><b>Resources</b></a></font></td>
</tr>
</table>
<!-- End "resources" button -->

</td>
</tr>
</table>


Note that both have php code in them ;)

Any help would be much appreciated!

Thanks
~Chris