web – Sheep Guarding Llama https://sheepguardingllama.com Scott Alan Miller :: A Life Online Tue, 17 Jun 2008 19:49:47 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.1 Firefox 3.0 is Out! https://sheepguardingllama.com/2008/06/firefox-30-is-out/ https://sheepguardingllama.com/2008/06/firefox-30-is-out/#respond Tue, 17 Jun 2008 19:49:47 +0000 http://www.sheepguardingllama.com/?p=2414 Continue reading "Firefox 3.0 is Out!"

]]>
Download FireFox 3.0 for free right now!

FireFox is the free, open source web browsing alternative.  It is the second most popular web browser currently and is fast, flexible and secure.  Highly recommended.  Go get it and try it out.  If you have used FireFox in the past be sure to check out version 3.0 as it is much faster than anything that you are used to using including FF2.

]]>
https://sheepguardingllama.com/2008/06/firefox-30-is-out/feed/ 0
Simple Website Management with PHP Includes https://sheepguardingllama.com/2008/03/simple-website-management-with-php-includes/ https://sheepguardingllama.com/2008/03/simple-website-management-with-php-includes/#respond Fri, 07 Mar 2008 11:52:55 +0000 http://www.sheepguardingllama.com/?p=2289 Continue reading "Simple Website Management with PHP Includes"

]]>
We all know the importance of the careful separation of websites into their three discrete elements – content in the form of XHTML, style in the form of CSS (Cascading Style Sheets) and behavior in the form of JavaScript. This is the basic foundation of correct, clean and functional web design. Once one has accomplished this basic building block of manageability one must look to external tools in order to achieve greater gains in website management and maintenance. Often we find a solution in heavy Content Management Systems or CMS. But often, especially for smaller web sites, there is a far simpler solution that still allows for growth and maintainability. Enter the PHP Include.

Before we get into discussing the use of the PHP Include for maintaining website I would like to first mention the oft forgotten Server Side Include or SSI. I have nothing against the old Server Side Include. I used to use it, in fact, and I believe that it is extremely functional. However, PHP has become so ubiquitous on web servers today (especially Apache) and it is so easy to use for this purpose that I feel that its advantages in growth and flexibility outweigh the slight increase in processing necessary to use it. PHP Includes are simple, straightforward and flexible when we want to start doing just that little bit more with our site than we did before.

The first step to working with PHP is to have PHP enabled in your web server. PHP requires nothing in the client browser – it is a web server only technology. Everything that we will be doing here is server side. Most web servers today already have PHP turned on and ready by default. The notable exception to this is Microsoft’s IIS where you will have to manually install PHP. Check the instructions for your particular web server on how to enable PHP for your use.

The process that I prefer to use when building a website using PHP Includes is to first build my first “prototype” page using traditional XHTML, CSS and JavaScript. One I have the basics of the page I then start by chopping out everything before the <body> tag and pasting it into a file that I like to call header.inc. I can then replace the entire section that I removed with the following simple PHP line:

<?php include("header.inc"); ?>

If this is your first time working with PHP this is a good time to test your page. I like to rename my pages from *.html to *.php once I have modified them. This makes it more evident to me what I am working on and when. I will assume that we are working on a default page here and that we can call it index.php. You should now test your page to be sure that it is rendering correctly. Any browser should now see the page as identical to the *.html equivalent. What we have done is simply take the top of the page and move it into a separate, reusable file. The PHP Include statement is simply taking the header.inc file and concatenating it back into the page at the last minute when the page is requested. It we were only ever to work on a single page this would be silly and a waste of time and effort. But it is a rare thing to have a web site with only a single page. Our goal here is to make a multi-page site easy to manage, control and standardize.

Now that you have the basics of the PHP Include working we can work on expanding its use. Simply handling the declaration and head portions of our page are not enough to make the PHP Include truly useful. This would reduce on-disk file sizes and remove a few maintenance tasks but the gains would be few. The true value begins when we start including portions of the page body in our includes. Now the fun really begins.

Now we need to identify the portion of the top of our page that will be common to every individual page that we will have in our site. In many cases this will be a banner area and navigational elements – most often a menu of some sort. We want to be sure to find every line that will be duplicated exactly and none that need to be different in each page. Once you have identified this page portion you can cut that bit of text and paste it to the bottom of your header.inc file. Quite often I find that this section will include quite a bit of menu markup as well as many “setup” tags such as common opening <div> tags. The more that you can manage in this manner the more value you get from it.

If you want, save everything and test the site again to be sure that nothing is broken so far. Nothing is? Good. Now we need to do a similar task to the bottom of our index.php page. We need to identify where the custom page-specific material ends and the common “wrap up” material begins. In my experience this is generally a relatively small about of markup but will often include a “bottom bar”, some <div> closeouts and often some late-running JavaScript such as Google Analytics or other tracking code.

Once you have identified the common bottom code that is shared, or will be shared, between your pages you can cut it out and paste it into a new file that I like to call footer.inc. The .inc extensions are not necessary but I find that it really helps to make these files easy to find. Now in place of the markup that we removed from index.php we can add in:

<?php include("footer.inc"); ?>

Now test your page again. Nothing should have changed in your web browser. But now your page is significantly easier to manage going forward. You can now create many new pages and simply start them with the PHP Include “Header” line and end them with the PHP Include “Footer” line and all you have to do from page to page is fill in the content that goes between. This will speed initial page generation but more importantly will make updates and management far easier. If you need to add a new <base> or <link> tag, for example, you can simply add it into header.inc and instantly it is applied to every page that you have created. When you create a new page and need to add a link into your navigational menu you can simply add it in and instantly every page’s navigation menu is updated.

Not every page will benefit from this approach but most traditional pages used by small business and most “brochure” style pages will. Often you may need to exclude your default page (a.k.a. index.html) because it might be different from all of your other pages. That is fine. Don’t let that be a show stopper for you. Just manage all of your other pages together.

To get even more value from this approach you can begin looking for common shared elements between pages. If you have a navigational bar that appears in the middle of the pages you could create navigation.inc and move that shared markup out to that file to manage more easily. Of course you can also do this with markup shared between any two pages – it doesn’t have to common to every page. Just use the appropriate PHP Include on the right pages and voilà, less work when adding content or making changes to your site.

]]>
https://sheepguardingllama.com/2008/03/simple-website-management-with-php-includes/feed/ 0
January 7, 2008: The Thaw https://sheepguardingllama.com/2008/01/january-7-2008-the-thaw/ https://sheepguardingllama.com/2008/01/january-7-2008-the-thaw/#comments Tue, 08 Jan 2008 03:23:50 +0000 http://www.sheepguardingllama.com/?p=2214 Continue reading "January 7, 2008: The Thaw"

]]>
Thanks to dad for this link to Bill Gates’ Last Day at Microsoft.

No Clearance On Side of Train

I guess this sign explains why it is important to pay for a train ticket. Clinging to the side of trains is not a safe way to travel no matter how economical it seems.

I discovered today that the Medina Railroad Museum has the largest single floor HO model railroad (apparently in the world but they don’t specify exactly on their website – it is 14′ x 204′.) Medina is located less than an hour west of Rochester between Rochester and Buffalo. There is so much stuff to do back home that I never realized was there when I lived there.

To those of you who are from “back home” it might be interesting to know that Arcade, New York in Wyoming County was once the sole production location for the soy product Cremora. Cremora originated in Arcade and was once exclusively shipped out on the Attica & Arcade Railroad which has been operating the line in Wyoming County since 1917.

Today is the first day “post financial industry freeze” and the real work begins anew. I had some stuff going on this morning so I was up at five thirty making sure that the early morning deployments were going smoothly. There was quite a bit going on so I ended up doing quite a bit of work before getting a chance to escape from the apartment.

The weather was awesome today. In the fifties. It was so warm that I didn’t even bother to take a jacket or a fleece or anything while walking to the office. And it was perfectly comfortable. Rumor is that we are going to be in the mid-sixties tomorrow. Now that is just crazy for mid-January.

I worked until after six and then walked to the train. Today I am listening to “I’m a Stranger Here Myself” by Bill Bryson. “I’m a Stranger Here Myself” is a book written from a series of newspaper articles that Bill – I can call him Bill as I am a familiar American – wrote upon returning to live in America after two decades of living in the Yorkshire Dales of Northern England.

On my way home from Manhattan I stopped by at Newark Penn Station’s McDonald’s and picked up dinner. Dominica and Oreo were home long before me and that makes the evening easier. Min was watching Heroes season two when I got home so I didn’t expect to see or hear from her for the rest of the evening.

I had more work to do for the office so I read the technology trades while eating dinner and then went back to work. Can’t complain about having too much work these days. There is a lot of expectation at the office that large workforce cuts may be coming down the pike in the next several weeks. This is the most concern that I have seen from my coworkers about layoffs since I started there about two years ago. But I figure that it is mostly just huff and that the layoffs, if there are layoffs, will hit us rather lightly.

Dominica watched all of the Heroes episodes that were available to her.  I worked until around ten thirty.  At that point I decided that I needed some of the evening to myself before needing to get off to bed so that I can go back to the office tomorrow.  I did get some good, important work done though so I am happy that I put in the time.

I did take about half an hour and practiced some classical guitar.  It has been quite some time since I have played that much.  I really need to get back to practicing on a regular basis.

I updated Dominica’s personal web site for her so that it is more of a resume site rather than her old attempt at a blog from 2002.  She managed to do just one entry before she gave up on that project but the one post has been lingering on her site for six years now.

We didn’t stay up too late tonight.  Got to get back into this work groove.

]]>
https://sheepguardingllama.com/2008/01/january-7-2008-the-thaw/feed/ 4