PHP 5 and Footer

Started to learn how to get the most recent modified date from the Lawyer Reserarch directory. Created a test page for that purpose.

Upgraded to PHP 5 so I could use the scandir function.

The CGI hit counter would no longer work using the include for reasons that I could not figure out. But I switched out the include statement for the following which works just fine:

<?php
$a = file_get_contents (“http://www.glenpritchard.com/cgi-bin/mcount.cgi”);
echo ($a);
?>

WordPress Theme Modification

header.php contains the style sheet references

index.php is the main blog page

style.css contains the styles.

Edited header.php to reference the menu style sheets

Edited index.php, adding a <div id=nav> to include the menu

Edited style.css to add #nav code used by the menu.

I probably now need to surround everything by the container.

Modify WordPress Default 1.6 Theme Background

Edited stylesheet.css as follows (added text is green; commented out text is red):

/* Begin Typography & Colors */
body {
font-size: 62.5%; /* Resets 1em to 10px */
font-family: ‘Lucida Grande’, Verdana, Arial, Sans-Serif;
background-image:url(‘/img/space2.gif’);
background-attachment:fixed;

/*GRP Edit    background: #d5d6d7 url(‘images/kubrickbgcolor.jpg’);*/
color: #333;
text-align: center;
}

Modify WordPress Default 1.6 Theme Header

Update: After finding all of this out on my own, I discovered an article on the subject. Rats!

In the Admin console, under Appearance –> Edit, edit the Header.php file.

Near the bottom look for: <div id=”header” role=”banner”>

Below that, remove this code:

<div id=”headerimg”>
<h1><a href=”<?php echo get_option(‘home’); ?>/”><?php bloginfo(‘name’); ?></a></h1>
<div><?php bloginfo(‘description’); ?></div>
</div>

This will remove the text from the header.

To modify the graphic underneath the now extinguished text, edit or replace the file ‘kubrickheader.jpg’ located at ‘wp-content/themes/default/images/’. (The boarders of this header blend in with the edges of the body of the page, so you probably want to edit the graphic to replace the blue box in the middle with the graphic you want to substitute.)

There were other tweeks that needed to be made to style.css to clean up the right and left side of the banner. Those modifications are marked by comments.

Modified Main Menu

Modifed the main menu so that background in main_menu-menu.css matchs the content  background, as follows:

.main_menu-menu li {
background-image:url(‘/img/eosbaga2b.jpg’); <!– Modified by GRP. Background color was #003366 –>
}
.main_menu-menu li li {
background-image:url(‘/img/eosbaga2b.jpg’); <!– Modified by GRP. Background color was #003366 –>
}
.main_menu-menu li li li {
background-image:url(‘/img/eosbaga2b.jpg’); <!– Modified by GRP. Background color was #003366 –>

Of course, the content background is ever changed in global-styles.css, main_menu-menu.css will have to change too.

Also changed hover color in code just below the above.

Problem with ‘Modified Date’

Today, the ‘modified date’ on the main page was 4/27/2010. I edited the content of that page, but the date did not change.

I edited the php file that called the content, and the date still did not change.

Conclusion: the modified date of the included footer file is what is being displayed.

Used a variable to identify the content file. Used the variable to include the file. Tried to also pass the variable to the footer file to determine filemtime of the variable file. No luck. Have reason to believe that I should not be using the absolute path when including the footer file. After changing to the a relative path, I got the variable to echo in the footer. Before moving forward, however, the index page I was testing started to display blank. I had to restore backup files to get it to work.  But I think this is the right track.

Update:  Set up a testindex.php and a footer.htm.

In  testindex.php, use a variable to name the content file to include. Then also use the variable to identify the file you want the modified date for. Both of the following must be true:

  1. The file name assigned to the variable must be a relative path. ‘content/index.htm’ works. ‘http://www.glenpritchard.com/content/index.htm’ does not work.
  2. The include statement to call the footer must also be a relative path.  ‘/ssi/testFooter.php’ works. ‘http://www.glenpritchard.com/ssi/Footer.php does not work.

Verified that filemtime() will not work with a file referenced with an http: address.

Update: updated all pages with new variable includes. Last Updated in footer now working as intended.

Posted: Wednesday, April 28th, 2010
Category: Site Updates

Converted Site to PHP

Converted nearly every page to PHP. Moved content to ‘content’ folder. All pages contain code, not content.

Pending issues:

  1. Determine whether modified date is the date of the footer file or the date of the file that calls it.
  2. All CSS and included files have absolute http:// references to graphics and style sheets. Determine whether this is best practices.
  3. The CGI counter now counts hits on all pages, not individual pages. The PHP include must work differently than the SSI include. All pages are now being counted in the CGI-bin file under one file.
  4. Confirm that all pages have same type reference to CSS and include files.

Revamped Legal Best Websites for Lawyers Page Using PHP

Finally tamed the “Best Website for (Ohio) Lawyers” page using PHP. Broke down each section into its own file. Used PHP include tags and if/then statements to construct the page depending on user input.

Removed a lot of really ugly code left behind over the years from WYSIWYG editors.

To:

  1. Update bad links.
  2. Add hover titles to quick link index section
  3. Add targets to open in new windows rather than leaving the site.