Category Archives: Site Updates

This is my record of changes to this site as I become a more articulate at web development.

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.

Photo Gallery Converted

Made progress in the wee hours converting the photo gallery to CSS. I had 2 installations of Gallery 2, and I was working on the wrong one. Had no luck creating a “local” version of of the template as described here. Also useful will be this page on customizing themes. The theme.tpl in the local directory simply would not take control of the parent file. So, I edited the parent file. The original file is in the local directory in the event that I ever need to restore the old theme. I also made some changes to theme.css in htdocs/Photography/themes/matrix/ which is the main style sheet controlling the appearance of most pages. I commented out the original code. The page does not render correctly from subdomain photography.glenpritchard.com. I will need to specify a static path to the style sheet files.

And then all of a sudden, without explanation or warning, the local copy of the Gallery theme.tpl kicked in and is running the show. Go figure. So, theme.tpl at ftp://glenpritchard.com/htdocs/Photography/themes/matrix/templates/local/ is the integration. The original file in the parent directory is the original full page version. I also changed the reference to all style sheets and graphics to static http addresses so that all elements work at http://photography.glenpritchard.com/main.php as well as http://www.glenpritchard.com/Photography/main.php. Largly finished tweeking the appearance of the gallery, although I still don’t like the blue background in the body area.

Converted Document Library and Paralegal pages to CSS. Added last modified date to footer. Added Facebook and LinkIn logos.

Added e-mail form

Added menu items. Converted “Who is Glen” page to CSS. Stayed up late last night trying to get the hit counter provided by Powweb to center in the footer. No luck. Will settle for static “serving the universe” footer until I can find and install a better CGL counter. Made adjustment to the style sheet to make text and hyperlinks more readable. Added ‘min height’ to the green box in which this text appears so the box will always be 500 pixels high even if empty. Rambled on enough to see how the text will flow around the YouTube video object to the right. Added a 10px margin to the <div> containing the video to prevent text from getting too close. Converted Hall of Accolades to CSS. Added the contact me page and e-mail form. Began converting Lawyers Favorite Websites page to CSS.

Posted: Wednesday, April 21st, 2010
Category: Site Updates