Sandcastles on the Beach Aug 12, 2008

How do you spell relief, the BEACH!

This last week was a great week. You don't always know that you need a break until you go back feeling better and ready to take on new challenges. Countries that mandate a vacation have the right idea.

Our trip to Duck N.C. was a welcome break and the weather could not have been better. This year the temperature stayed in the high 80s and the water was not frigid. We where at the beach everyday at low tide. Thomas really enjoyed jumping waves and learning to boogie board.

I enjoyed the break from trying to pound knowledge into my head. This summer has been about improving my Photoshop and Flash skills and I have improved. But it was getting to the point of headaches if I picked up any book relating to any subject. The motivation was slipping a little bit.

We always stay at House 'N Duck located in Duck, N.C. It's a great house that's always taken care of and allow dogs for the week. Plus it's only a short walk to the beach and to the shopping and resturants.

One of my favorite activities on the beach is sandcastle building. I'm no pro at it but it's fun to try new things and to make a castle that is more than turning over a bucket filled with sand and saying finished. Since my son was able to walk one of his favorite event is Sandcastle destroyer.

Normally he destroys anything I'm building well before I ever complete my work. Those sand bucket towers are gone two seconds after their built. I never mind because their just sand. It's part of the whole process. This year was different, he's old enough now that he can wait. I will have to post the photos I have of him comtemplating which rampart he'll take out first.

Thomas deciding which part to destroy first.Since I can now keep him from demolishing anything I make as I do it, the castles have improved and they are a lot better. This gives me the time to really work on them. I also think that it makes it more fun to destroy.

He's developed the sneakiness that it takes to do it before anyone can stop him. You think it's safe so you go back to reading a book or watching the surf. The next moment there is mass destruction going on and a huge smile of his face. "Mission Accomplished! Next castle Daddy!"

Again, that's how it goes on the beach.

Lets Go O's Jul 25, 2008

Let's Go O's It's summertime and one of our favorite pastimes is to watch our Baltimore Orioles play at Camden Yards. The park is beautifully laid out and well maintained.

What is even better is that Thomas is now at an age that he really enjoys the game and all the extras that happen when you go to the game. Like any other sport, if you are just interested in the game, stay home and watch on the TV and the food is free and the drinks are cold.

Going to the game is about standing up and singing the National Anthem. About getting peanuts and hot dogs from the hockers walking through the bleachers. I admit I do more shelling of the peanuts and Thomas does more of the eating all my hard work. That's what a father does for his son.

When your team is at home, you cheer for the home team. The only time you should be rooting for the visiting team is when you've traveled to another city and you are cheering for your team. That's the way it should be. No booing of our team because they're off tonight, even if tonight last an entire season.

Last Friday night the O's took on Detriot Tigers and after exchanging the lead a couple of times won 7-4. But again, that isn't always the important part of the night. It's about being out with friends and family.

So until the next game we can go to, Let's Go O's!

Altering Page Titles Dynamically Jul 8, 2008

Looking at my site I constantly find things that need to be improved upon and fixed. One of the first items on my list is to correct the way my page titles appear. Currently there is only one title for the entire site. That just won't do!

Here at the school house we teach that the page title should reflect what is on the page. If the page is about apple pie recipes, the title should tell you that the page contains pie recipes. Simple enough and it is simple enough when dealing with static HTML or pages that do not dynamically interact with a database on the server side of the house. Page titles also help with your bookmarks. They are the starting point for what your bookmark will be until you modify it. The other important part of a bookmark is that it records the Uniform Resource Locater or URL which is your page's mailing address on the Internet.

In HTML/XHTML the <title> tag is located inside the <head> section of the document. You can add it to your page and it will reflect in the top of your program window and in your tab if you are using that browser feature. If you select "Bookmark Page" the page title will be the default field that you see in the dialog box. Take a look at Google and see how their page title appears. For more about the TITLE element visit the W3's page on the Title Element.

Since this site is built upon server side includes I only have one <title> tag. The first step for me to take is to change the static text of "Benjamin Olvey Photography & Design" to a PHP variable, i.e. $pagetitle. The next step is to create a switch function that will look at the URL page requesting the include and change the $pagetitle variable to reflect the content of the page.

The case switch statement I'm starting with is

<?php

$page = basename($_SERVER['SCRIPT_NAME']);
switch($page) {
case "about.php":
$pagetitle = "About OlveyPhotoDesign.com";
break;

case "webdesign.php":
$pagetitle = "Website Designs by Benjamin Olvey";
break;

case "photo.php":
$pagetitle = "Photography by Benjamin Olvey";
break;

case "contact.php":
$pagetitle = "Contact OlveyPhotoDesign.com";
break;

case "articles.php":
$pagetitle = "OlveyPhotoDesign.com Blog";
break;

default:
$pagetitle = "Benjamin Olvey's Photography & Graphic Design";
}

?>

At the simplest level this means that when photo.php request the header include the switch will set the $pagetitle variable to "Photogaphy by Benjamin Olvey" therefore reflecting the content on the page more accurately.

The item that makes the switch statement work is the variable it is examining. I used the basename function which determines the filename from the directory path set in the $_SERVER Global Array field "SCRIPT_NAME". This array is automatically generated by the server when it receives a php page request.

As the switch statement is ran, it will try to match each case until it finds a match. When it does, the $pagetitle variable will be set to reflect the content of the page. Afterwhich the break; command exits out of the switch statement. If no case matches the $_SERVER['SCRIPT_NAME'] then the default $pagetitle is set. To read more about the $_SERVER array visit the PHP Manual.

The break command is important in that the switch statement doesn't need to continue if a case has been matched.

So far I have really only tackled the upper tier to my site. When we go into my blog all it will say is OlveyPhotoDesign.com Blog. What I have to tackle now is getting the switch statment to change the page title to reflect the content that is being filter to the viewer. If you click on a Hobbies topic from the blog, I want the page title to reflect "OlveyPhotoDesign.com Blog: Hobbies." Then when an actual article is being veiwed the title will show the article title "OlveyPhotoDesign.com Blog : Altering Page Titles Dynamically."

To get this far I will have to employ the $_GET data array that is the work horse behind the filtering process. But that is another days work.