Monthly Archives: April 2010

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.

PHP Operators

Learned that ‘=’ can be used only for assignment of values to variable, i.e. x=3.

If you want to compare to variables in a conditional, you must use ‘==’, i.e. 2==3 is false.

Updated Lawyer Favorites Page

Broke down the page by section. Now want to have a single page that will reload itself, containing the section selected and the index.

This article suggests how to write a php page that would accept a variable. Now I need the syntax for if/then/else so that the page would include different text depending on the passed variable.

This article discusses if/then/else.

Try this:

if (some test) $nextpage = ‘page1.php‘;
else $nextpage = ‘page2.php‘;
header(“Location: $nextpage“);

More about Gallery2 Customization

Interesting Discussion here:

I have revised my position (and the page) since this original post. I found performing the include was to problematic in that manner. I have returned to manipulation of the theme.tpl for output (viewable), and .css changes for control of how it is rendered.
————————————————————————————————————————-
The php include worked like this however- I made a page which was called new.php, on which the design (style) of the page was defined using existing site specific css. I utilized it exactly like a template file, but instead of call for content, the page was strictly for links and positioning of site specific navigational blocks/areas. the conclusion of the page was left ‘open’….meaning the last line was <div id=”content”>. Then another page was created titled newend.php, and you guessed it- was everything I wanted displayed after the division content was sealed. Then I went into gallery, and on the page titled main.php, in the header I linked the existing site specific css adjacent to the gallery generated css. Just under the header I performed a php include “../new.php”; and at the end of the page another include “../newend.php”;…the output on some browsers was decent, and flat bad on others, there were too many things to go wrong so I quit this method.
————————————————————————————————————————-

The manner in which I do it now is just link the site specific css in the head of the theme.tpl I have chosen to use. Then I C&P everything from new.php before any gallery specific calls…which includes opening the div tag content..it works. Tweak the css for some things an it seems to be fine. I set up overflow to auto, and changed the block for admin tools to be specific size and overflow scroll as wel. the font needed changing in both methods from em’s to absolute (I used 8, 10, and 12pt)….

If you would like copy of these files I will get them to you, but it is not something you can see by observing source, because much of it is pre-handled.

And this about adding hit counter to bottom of pages.

This obviously brings Gallery2 into the website. Maybe this is the way to go.

Testing PHP and paths in PHP code

Created a test php version of the index page. Had to update the ssi include codes to php includes, such as <?php include(“./ssi/Main_Menu.htm”);?>. Learned that the syntax for the path of an included file in different in PHP. In HTML, starting the path with ‘/’ means the root of the web site. In php, ‘/’ means the root of the web server. As suggested here and here, there must be php code to change the location of what is considered ‘root’, but I have yet to figure this out.

There must also be PHP specific code to include the “last modified date” and to run the CGI hit counter. Found this solution for CGI in PHP:

<?php echo system(‘mycgi.cgi’); ?>

is probably easier still. You may have to specify the directory with ./ or even more fully with http://www.example.com/ .

The above did not work on my site. Powweb must require an include statement. The syntax that works is : <?php include(“http://www.glenpritchard.com/cgi-bin/mcount.cgi”);?>

As for the last modified date, the discussion here is useful, although the last entry is confusing and does not seem to work.