Category Archives: Site Updates

Filtered by Tag: PHP (unfilter)

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

Style Sheets for Printing

Modified the paralegal internet research page, to display answers to the lab problems after a code is given in a form. Used a php header statement to redirect to the print page if the correct code was given.

I freaked out a little. After doing a lot of work to get this page to work correctly, I tried to print the hand out. The print-out looked nothing like what displayed on screen. The answers were not indented, the font color was missing, the automatic numbers were gone.

Turns out, it was a problem with my stylesheet reference. I had been using

<link rel=”stylesheet” type=”text/css” href=”” media=”screen”>

The problem was ‘media=”screen”‘. I did not know that you can specify different style sheets for printing and on-screen viewing. Specifying ‘media=”screen”‘ means that the style sheet will be used for what is displayed on the screen and not what prints.  Using ‘media=”print”‘ will work for printing, but not anything else. To use the same style sheet for all purposes, ‘media=”all”‘ may be used.

W3C has a nice reference about style sheets. It also has a reference about media types.

Update: Because the style sheets are cascading, there was no need to redirect the research page to a separate print template. The same page can be used for screen and print! For future reference, the redirect code, which must go at the top before the <html> tag,  looks like this:

if($_GET[“code”]==”reject4053″) {

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:

$a = file_get_contents (“”);
echo ($a);

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.

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 .

The above did not work on my site. Powweb must require an include statement. The syntax that works is : <?php include(“”);?>

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