Forum Moderators: coopster
It's a little sloppy and redundant (extra CSS) to overcome a specificity issue with text-align: center, and it's liable to raise the roof with some people over tables layouts vs. CSS positioning, but here's the bottom row of a 3-column tables layout with a PHP include for the footer section, styled with CSS.
>>The copyright date updates automatically, with either just the current year (if the site is new), or for an older site Copyright (start year) to (current year).
>>Last modified code puts the current date in when a page is uploaded for updates.
In .htaccess to parse .htm or .html pages for PHP
(One or the other, depending on the server.):
AddType application/x-httpd-php .html .php .htm
or
AddHandler application/x-httpd-php .html .php .htm
==========================================
In the HTML page (bottom row of a 770px wide table):
<div class="bar"><?php include("../folder/footer.php"); ?></div>
==========================================
In the footer.php file:
<div class="ftr" align="center">
<p> Copyright © <?php
$startYear = 2003;
$thisYear = date('Y');
if ($startYear == $thisYear)
{echo $startYear; }
else
{echo "{$startYear}-{$thisYear}"; }
?> This Site. All rights reserved.<br>
<a href="http://www.example.com/" target="new">Web Design</a> by Somebody.</p><br>
<p><?php echo "Last modified: ",date ("l, F d, Y", getlastmod());?></p>
</div>
===========================================
In the linked stylesheet:
.bar { font-family: verdana,sans-serif; font-size: 9px;
color: #FEFFCC; text-decoration: none; }
.footer { font-family: Verdana,Sans-serif; font-size: 9px;
color: #FEFFCC; text-decoration: none; }
div.ftr p {font-size: 9px; font-weight: lighter; color: #ffc; display: inline; }
div.ftr a {font-size: 9px; font-weight: lighter; color: #ffc; text-decoration: none; }
=============================================
The heading graphic (table row 1), the top navigation bar (table row 2), and the left navigation (part of the content section) are all PHP includes now part of the DW default page (no Libraries or Template needed), styled with CSS, and the conversion was also from leftover font tags (from years ago) to CSS for fonts and links, etc. And Google Analytics code last thing before the </body> is an include, but will be added to the basic HTML framework for each individual site.
Next is automating the <title> and <head> sections when I find out how to use a linked flatfile database for the non-static items that need to be individual for pages.
So doing some reading in books, and spending hours going through and setting out to learn to "read" code in this and the Apache forums, have started to be well compensated for already by saving time on just a couple of sites - so far.
however it's likely better here as it's more to do with the PHP code for updating dates
a <td> is an element that you can use CSS on just like any other, it's not only <div>'s that can have classes :) so you could possibly simplify your hybrid even further.. in your HTML template - I presume the bottom/footer row is a <td> spanning the three columns?
if so you could give that <td> the footer class and never mind the extra 2 x wrapper divs!
html:
<td colspan="3" class="ftr"><?php include("../folder/footer.php"); ?></td>
==========================================
In the footer.php file:
align="center" is deprecated so do this
<div>
<p> Copyright © <?php
$startYear = 2003;
$thisYear = date('Y');
if ($startYear == $thisYear)
{echo $startYear; }
else
{echo "{$startYear}-{$thisYear}"; }
?> This Site. All rights reserved.<br>
<a href="http://www.example.com/" target="new">Web Design</a> by Somebody. <?php echo "Last modified: ",date ("l, F d, Y", getlastmod());?></p>
</div>
===========================================
In the linked stylesheet:
.ftr {
padding: 0; /*override any cellpadding*/
font-family: verdana, sans-serif;
font-size: 9px;
font-weight: normal;
color: #fff;
text-align: center; /* equivalent of getting internal elements to center their text */
}
.ftr p {
/* this should inherit the formatting from the td settings above */
}
.ftr a {
color: #ffc;
text-decoration: none;
font-weight: bold;
/* put any other link specific rules in here */
}
.ftr a:hover {
color: #cfc;
}
There should be no need to make two paragraphs and then have them display: inline, simply put the date in the main <p> too. If you did want to wrap it in something, perhaps in order to format it differently then wrap it in a <span>
And there's not actually much need for that wrapper div I've left in footer.php, because the <td> element would be the wrapper, though you could insert one like I have, as it could be used to aid specificity if necessary.
HTH, and thanks for the tip on updating dates via includes ;)