Saturday, April 22, 2006

Templatize Your Website with SSI - Server Side Includes - Step by Step

Most websites maintain the same headers, footers and margin navigations on each page. This is good design. The common look tells your visitor she is in a unified environment and ever-present links make site navigation easy.

As your site grows, changing those common elements can become laborious because changes must be made on each page of your growing site. Using SSI - Server Side Includes, these elements need be changed only once. All your pages can use the same template files for important repeated elements of your web pages.

When you set up pages for SSI, you include special SSI links to separate template files. Your web server includes them in a single web page file before sending them to the visitor's browser, thus the name Server Side Includes.

Convention used in this article: Filenames and URLs are displayed in quotes. Do not use the quotes when doing your work.

In order to templatize your website with SSI, you will need:

1.   FTP access to the root folder of your site (the folder which contains your home page, typically named "index.html" or "index.htm").
2.   Rights to add files and folders there.
3.   Basic knowledge of HTML, to the extent that you can recognize the beginning and ending of portions of your site you wish to templatize.
4.   A copy of your website on your local computer. If you have the items listed above, you can download your site to your local computer.
5.   Your site must be hosted on an Apache server with SSI enabled.

Step 1 - Check if SSI is Available & Enabled


a.   Open Notepad.
b.   Click File-Open. Where it says "File of type:" select "All types". Click on your "index.html" or "index.htm" home page.

c.   Beneath the line containing the <body> tag, enter the following:

         <!--#echo var="date_local"-->

d.   Click "File/Save As".
e.   At "File of type:", select "All types". Rename the file "s-index.html" and click "Save". This is your future upgraded home page.
f.   Upload the file to your server in the root folder.
g.   Open your browser and navigate it to your new web-based "s-index.html" file. You should be able to do this by typing your site's URL followed by "/s-index.html". Let's call this example URL:

        http://www.yourdomain.com/s-index.html

where "yourdomain.com" will be replaced by your actual domain.
h.   If the local date displays on your page, you have SSI enabled.
i.   If you do not see the date displayed, try renaming your file with an ".shtml" extension instead of "html". If it still doesn't work, contact your webhost or system administrator.
j.   Remove:

         <!--#echo var="date_local"-->

from your local "s-index.html". Save it, upload it to your server, refresh your browser and verify that you have successfully removed it.

Step 2 - Create .htaccess file

a.   Open Notepad.
b.   Paste the following code into it:

        Options Indexes FollowSymLinks Includes
        AddType application/x-httpd-cgi .cgi
        AddType text/x-server-parsed-html .html
        AddType text/x-server-parsed-html .htm

c.   Click "File/Save As"
d.   Navigate to the root folder of your local site.
e.   Where it says "Save as type:" select "All Files"
f.   Name the file ".htaccess" and click "Save".
g.   Upload this file to the root folder of your site.

Step 3 - Create SSI Folder

a.   Open Windows Explorer
b.   Navigate it to your website's root folder.
c.   Left-click the root folder to highlight it.
d.   Left-click "File/New/Folder" on the top menu bar.
e.   You should see a new folder placed under the main folder. Right-click it and select "Rename". Rename the folder "ssi" (without the quotes). You will save your templates there.

Step 4 - Your First Server Side Includes File

a.   Open Notepad. You will have opened an empty file. Type:

        Chickens are delightfully silly animals.

b.   Click "File/Save as" and navigate to the "ssi" folder you just created.
c.   Where it says "Save as type:" select "All Files"
d.   Name the file "chicken.sht". This is your very first template file.
e.   Open "s-index.html" in Notepad.
f.   Just below the <body> tag, paste these lines of code:

        <!--BEGINNING OF CHICKEN-->
        <!--#include virtual="ssi/chicken.sht"-->
        <!--END OF CHICKEN-->

g.   The top and bottom lines are simply notations which will render only when the source code is displayed. They will come in handy. The center line of code will tell your server to replace itself with the contents of the file "ssi/chicken.sht".
h.   Save "s-index.html", then upload it to the root folder of your web server.
j.   On your webserver, in the root folder, create a new folder named, "ssi". Upload "chicken.sht" into the "ssi" folder.
k.   Open your browser. Type:

        http://www.yourdomain.com/s-index.html

in the address bar. If it was already there, refresh the screen by clicking the "Refresh" button, or by pressing the F5 key. If all went well, you should see our cutesy chicken comment rendered on your page.
l.    On a blank area of your web page, right-click and select "View Page Source". Scroll down until you see the   "<!--BEGINNING OF CHICKEN-->" tag. It should look like this:

        <!--BEGINNING OF CHICKEN-->
        Chickens are delightfully silly animals
        <!--END OF CHICKEN-->

m.    Notice anything? The code  "<!--#include virtual="ssi/chicken.sht"-->"  was completely replaced by the contents of the "chicken.sht" file with no trace of the original line of code. This is why the beginning and ending notation tags are useful. When viewing the source, the notation tags will be the only way you will know you are looking at files included at the server.
n.    Remove the three lines of code in the local "s-index.html", save it and upload it to your server. Refresh your browser and verify that your page no longer is full of "chicken.sht".

I am having way too good a time with that filename!

Step 5 - Create SSI Template Files

a.   Open Notepad. You will have opened an empty file.
b.   Click "File/Save as" and navigate to the "ssi" folder you just created.
c.   Where it says "Save as type:" select "All Files"
d.   Name the file "top.sht". This is the future home of the template for the top of your page. Click "Save".
e.   Click "File/Save as" again, and again, navigate to the "ssi" folder.
f.   Where it says "Save as type:" select "All Files"
g.   Name the file "left.sht". This is the future home of the template for the left side of your page. Click "Save".
h.   Repeat steps e, f and g again, but this time, name the file "right.sht".
j.   Repeat steps e, f and g again, but this time, name the file "bottom.sht".
k.   You have now created future homes for templates for the top, left, right and bottom of your web page.

Step 6 - Place SSI Links and Annotation Markers in "s-index.html"

a.   Open "s-index.html" in Notepad. Stretch the window wide and short so it covers the width, but only the top half of your screen. Think of this as your source file.
b.   Open "top.sht" in a new version of Notepad. If you don't see it listed, remember to select "All types" where it says "File of type:". Stretch the window wide and short so it covers the width,but only the bottom half of your screen. Think of this as your target file.
c.   Examine the code in the upper window and make sure you know where the code for the top of your web page begins and ends. You will soon cut this hunk from "s-index.html" and paste it into "top.sht". But before you do:
d.   Be sure you have selected a coherent body of code:

TIP #1: Look for hunks of code which begin and end with major tags such as <table> and </table>. Include the tags and everything between them when selecting portions of a web page to templatize.

TIP #2: DO NOT INCLUDE:
        <html>,</html>,<head>, </head>,<body>,or </body>
EVER IN SSI TEMPLATES OR HELLFIRE AND BRIMSTONE WILL FALL FROM THE HEAVENS UPON YOUR POOR ACCURSED HEAD and besides which, it won't work.

d.   Immediately above the hunk you selected in "s-index.html", type the following three lines:
        <!--BEGINNING OF TOP-->
        <!--#include virtual="ssi/top.sht"-->
        <!--END OF TOP-->

e.   Then, right-click-cut the hunk of top code from "s-index.html" and right-click-paste it into "top.sht". It must be removed from "s-index.html".
f.   Save both files and upload them to your server. The "s-index.html" will replace the one already posted on your server in the root folder. Be sure to save "top.sht" in the "ssi" subfolder you already created at the server. You will recognize it because it still has some leftover "chicken.sht".

        Ha! I did it again! Note to self: Get life soon before too late.

g.   Point your browser at:

        http://www.yourdomain.com/s-index.html

If it is already thusly pointed, refresh the screen. If your web page looks absolutely normal, you probably did one heck of a good job.
h.   If your page looks gnarly, go back to the beginning of this section and try to figure out if you missed including important beginning or ending tags, or if you included the FORBIDDEN TAGSmentioned in TIP #2 above.
g.   If you really screw up, start from scratch by deleting all contents of "top.sht", and saving it empty. Then, open "index.html" and save it as "s-index.html" and start again at "a" above.

Step 7 - Go into Production & Go Live

a.   Once you are stabilized with templatizing the top of your web page, move on to the other portions, one at a time.
b.   Do the full cycle of Step 6 (a thru g) for "left.sht" before moving on to the others. This will reduce chances that you will receive a nasty shock when you open the latest and greatest "s-index.html", only to find that it resembles a genetic mutation of the undesirable variety (as opposed to Angelina Jolie).

Go slowly and deliberately. Remember, these templates will be with you for a long time. Make sure you are including the correct amount of code.
c.   At the end of this process, your website will look exactly like it did yesterday. Underwhelming? Yes, until you view the source code and realize that all the content between the notation markers was imported by your server because of your fine work.
d.   When you are satisfied that "s-index.html" is functioning properly (check all the links, for instance), you can "go live".
e.   On your server, change the name of "index.html" to "x-index.html" and leave it on your server as a backup. Then rename "s-index.html" to "index.html". You are now operating live with your great new templated home page.

Step 8 - Test & Prepare to Propagate

a.   There is no rush to propagate your changes to other pages. Your website will work just fine with some pages migrated to the new template system and some not. This will give you the luxury to do a few tests before propagating the changes.
b.   Run a few sitemap generating programs on your site to verify that the same number of pages are recognized, and that you have not lost friendliness to search engines. When I first converted my home page to an SSI templated version and ran the XML Echo Sitemap Generator, I was pleased to find that there was no loss of link recognition.
c.   Monitor your website traffic for a few days. For my website, it seemed that after converting the home page, my hits from search engine spiders and from search results actually increased to a moderate extent.
d.   Now that you are convinced that all is well, it is time to propagate the change.

Step 9 - Propagate Your Changes

a.   Change your local filenames to reflect changes you made on the server. For example, change the local "index.html" to "x-index.html" and rename "s-index.html" to "index.html". Now your local website and the live one should have the same content.
b.   Create an "empty template page" which you will reuse repeatedly during change propagation. To do this, in Notepad, open the new "index.html", which, if you performed step a above, is now the SSI templated one. Save it under a new file name, "template1.html".
c.   While it is still open, locate the point at which your actual home page content, the important stuff in the middle of the page, begins. Above it insert this notation:

        <!--BEGINNING OF BODY-->

At the end of the important page content, insert:

        <!--END OF BODY-->

d.   Delete everything between, but not including the two notation tags you just entered. They will now be next to each other. Insert a few rows between them and save your file "template1.html" again.
e.   Upload it to your server, then address your browser to:

        http://www.yourdomain.com/template1.html

If you see a wonderfully empty page, which has all the templates rendered at the top, left, right and bottom, then you are one hot webmaster and deserve a well-shaken martini.
f.   When you recover from the effects of the martini, you can start your propagation program. Open the first page you want to change in Notepad. Let's call it "page.html". Stretch the window wide and short. Locate it in the top half of your screen. Think of it as the source.
g.   In a new version of Notepad, open "template1.html". Stretch the window wide and short and drag it to the bottom half of your screen. Think of it as the target.
h.   Right-click-copy only the unique page content from "page.html" and right-click-paste it between the annotation tags you just created in "template1.html".
j.   Save "template1.html" under a new filename: "page.html". Close the original source "page.html" WITHOUT saving it.
k.   Upload the modified "page.html" to your server, then view it in your browser by navigating to it normally. Be sure to refresh the browser to make sure you are seeing the latest version. If it looks like the original page, congratulations!
l.   View the page source. You should see five sets of annotation tags sprinkled through the page. Four of those sets will surround content which was included by the server from your template files. The fifth set will surround the body contents which you manually imported.
m.   Now that you know how to update your web pages so that they share a single set of templates, consider the following:

Let's say that your site has 50 pages. You will need to perform the manual update 50 times. After all that work you will have a site visually identical to what you had before. And it will be only moderately more attractive to search engines.

Why not do some SEO (Search Engine Optimization) as you go?

Step 10 - Improve SEO - Search Engine Optimization - as You Go

a.   Search engines love regular improvements to websites. Take this opportunity to tantalize them with improved content.
b.   Think about the time you can devote to the effort. If you, like me, have a day job and a family, pick a rate of work you can live with. Rather than pulling an "all-nighter" and templatizing your entire site, consider changing, for example, only 3-5 pages per day. At the end of each work session, run a new sitemap and notify Google.

See How To Make & Submit a Google Sitemap

Quick & Dirty Checklist for Upgrading Your SEO

a.   Write down a list of maximum 4 keywords or key phrases per page.
b.   Include these in page title, meta-keywords, meta-description.
c.   Be sure your pages use 2-3 sets of <h1> and <h2> headers, and that your key words and phrases are presented there.
d.   Be sure your keywords and phrases are also written within the paragraphs, especially at the beginning and at the end.
e.   If your pages contain over 500 words within the unique body portion, consider splitting the content into two or more pages. If you do this, don't use identical keywords and phrases. Modify them slightly for each page to emphasize a different aspect of topic.
f.   If you have images, be sure to utilize ALT tags for each image, and use variations of your key words and phrases in this text.
g.   Very important: At the end of each work session, run and upload a new sitemap and notify Google.

Best of success to you in this substantial, important venture.
Stick with it and your site will become better immediately and much more easily improved in the future. Your feedback is most welcome.


Like this article? Bookmark it at Del.icio.us


To receive these postings hot off the keyboard,
subscribe to poingology, the newsletter


Mark Meshulam offers:
keyboard hotkey shortcuts and screen grabs,
email ticker reminder system,
send large files with FTP and links, all at
www.poingo.com

Sunday, April 16, 2006

Wipe Away Half-Assed Communications

Sad to say, but many business communications I receive are simply crap.

Verbal: Company representative answers questions by guessing and "shooting from the hip". Her misinformation is acted upon by others who later must undo their actions when the real information is found. She loses the respect of co-workers and causes chaos on the project.

Lesson: Engage brain, perform research, then open mouth. If you don't know, say "I don't know. I will find out and respond later today."

Written: Plant manager sends email with Excel attachment. The email contains a portion of the content, the attachment carries the rest. The attachment has no date, company name, title or author name.

Lesson: Put your content in either the email or the attachment if it is on the same topic. Don't split it up. Think about trying to recreate the chain of events later. Make your project history easy to track.

If you send an attachment, make it a credible document complete with date (not an auto-date) company name, your name and document title. Add a logo. Remember, every document is a reflection on you and your company.

Verbal: Salesperson goes to manager and starts talking in the middle of the subject rather than at the beginning. Confused manager is forced to ask, "What customer are you talking about? What project?"

Lesson: When you talk, start from the beginning. You owe every conversation a topic and a subtopic before you launch into your discussion: "Hi Rita, I am calling about the Green project, where we are having a late delivery problem..."

Written: Project manager writes an official report sprinkled with colloquialisms.

Lesson: Some phrases are fine when spoken but look awkward on paper. The written word is more formal. Don't write as if you are talking over a couple of drinks. Have a more literate co-worker proofread your report and learn from their comments.

Web Ads: The following misspellings were present in a single page view of ads posted on a popular website:
harnessess the power of the internet (sp)
Trully Amazing. (sp)
Dont missout.Clikk here. (sp,sp)
Please visit us and see the animation of the books. (syntax)
Simply read an Ad Then this Money Making program is for You. (weird caps)
Home Buisness Solutions Tailored For You (sp)

Lesson: Want to sell on the internet? Your credibility depends upon your ability to write correctly. Your words are often the only thing seen by potential customers.

Verbal: Project manager comes to supervisor and begins rattling off an analysis of current cost numbers on his job. Supervisor's brain, which was already filled with other information, implodes. Wrong decisions are made based upon misunderstandings. There is no paper trail to review later and see what went wrong.

Lesson: If you have a list of numbers to share, put them in writing with succinct descriptions for each number. This discipline might cause you to better understand and analyze your data before you present it to others. When you do present it, you will be more credible. Your audience will be better able to absorb your data during your presentation now and also later.

Written: Job applicant writes two-page (single spaced) thank-you letter after job interview to the company he interviewed with. It drones on and on about how much he likes the company and how much he could contribute. The busy recipient of the letter thinks, "This guy can't get to the point. He spends too much time writing an overly long letter. He will do this if he works here. Nothing will ever get done. Next applicant."

Lesson: Have you noticed we are in a sound-bite society? As a group, we all have A.D.D. (Attention Deficit Disorder). Long letters went out with Thomas Jefferson. Less is more. If your new sentence restates a previous sentence, delete it. If you tend toward blab-osis, write a separate list of your key points, then write your letter, allowing yourself only two sentences to make the point.

Verbal: Job applicant receives a job offer during an interview. He looks at the offer and makes a sour face. He says, "Is that the best you can do?" Interviewer immediately regrets making the offer and mentally discards any possibility of improving it.

Lesson: A job offer is a gift. Whether it meets your needs is a separate issue. Don't make the gift giver feel ashamed or belittled by showing emotional dissatisfaction. Business is business; it revolves around transactions which are negotiated based upon a win-win scenario.

If the offer doesn't meet your needs, do the following:

1. Thank the offerer for the offer. Express that you feel complimented by the fact of having been made an offer. Appreciate the effort expended by the offerer.

2. If you are not sure about how to respond, tell the offerer that you would like a few days to think about the offer and/or discuss it with a significant other. Ask if a particular date would be acceptable for a response. If so, respond on that date.

3. When you do respond, be clear about where you are going before you start communicating. If salary is the issue, have your target salary, and also the minimum salary you would accept, clearly in mind. Also, have your reasons for these clearly in mind.

4. When it is time to respond, start by, again, thanking the offerer. Express the hope and desire that you will be able to join the company. Then gently, even apologetically, break the news that you can't accept the current offer. State your reasons.

Here is my list for the best reasons your offerer should increase his offer:


  • Other offers you may have received. This calibrates you to the market.
  • Your previous salary, along with your desire to continually improve your position in life. This is market-based input which also communicates a drive to succeed which most employers would find attractive.
  • Your family's minimum living requirements. Human needs are tough to argue and are not offensive. If your family needs a certain salary level in order to survive, the employer will understand on a human level and will be motivated to try to reach that level.

Best of luck sharpening your business communications!

Like this article? Bookmark it at Del.icio.us


To receive these postings hot off the keyboard,
subscribe to poingology, the newsletter


Mark Meshulam offers:
keyboard hotkey shortcuts and screen grabs,
email ticker reminder system,
send large files with FTP and links, all at
www.poingo.com

Saturday, April 08, 2006

Odd Thoughts

Our world can be filled with wonderment, if we only took the time to notice things around us. Unfortunately one man's wondrous can be another man's stupid. Here we go:

SHMORGASBOARD
Is there a food out there called "shmorgas?" It sounds tasty. Next time I go to a shmorgasboard, I'm ordering the shmorgas.

REMARKABLE TECHNOLOGICAL ACHIEVEMENT
Those little labels which are stuck to the fruit at the grocery store. Wow. Who ever thought of that?

Now we need another remarkable achievement. Something to help us get them off. Or at least make them edible.

RELATED ACHIEVEMENT
Post-It notes. Not the notes themselves, but the idea that someone made ZILLION$ selling little slips of paper with bad adhesive on them. I'm really mad I didn't think of that.

DIT-DIT-DIT
When you are on the phone with someone who pauses to find something, why does he feel the need to fill the silence with "dit-dit-dit?"

SHEEP DOGS
I saw a sheep dog in the elevator of a downtown high rise and I thought, "Has that poor creature ever even seen a sheep?"

How must it feel for an animal, its genome programmed throughout millennia for herding sheep, to live with an unfulfilled destiny? Would he feel an existential emptiness? I felt that he was looking at me wondering, "Are you a sheep? Can I herd you?"

I think owners of sheep dogs should be required to buy a few sheep so their dogs don't experience a haunting void. Or am I overthinking this?

HEALTH FOOD AND IMMUNITIES
The trend toward pure, organic food may be lowering our resistance to harm from bad food, impurities and preservatives. I don't think our systems will fare well over the long run being so unchallenged. Immunize with a Twinkie today!

SEAT BACKS AND TRAY TABLES
If you hear the words "Please put your seat backs and tray tables in the locked and upright position", do you you automatically get that airplane feeling?

CHIC WAITERS
The waiter came to the table and said, "I'm Tom and I will be your waiter for tonite." and I wondered, "Who were you yesterday and what did you do then?"

EXPERTS
For anything you can name on earth or beyond there will be at least one expert.
No matter what the topic, there will be someone, somewhere who devotes his life to it. I bet the guy in charge of cockroach sphincters is a blast at cocktail parties.

BETA
If you were doing a preliminary study of the tropical fighting fish Betta splendens, would it be a betta beta? Would the ultimate preliminary version be a master betta beta?

BIG RIDICULOUS CARS
A guy I know once said, "You are what you drive." I peeked outside to check out his ride. It was a purple muscle truck with enormous wheels. I thought, "I guess that makes you a purple muscle truck with enormous wheels. Can we abbreviate that to "moron"?

On a related note, are there any studies of penis size of Hummer drivers? I am guessing they really don't need all that leg room.

MEALS ON WHEELS
According to a survey of Mark Meshulam, at least 50 percent of his meals are eaten in the car. Since Mark belongs to an intensively studied demographic - "Baby Boomers Too Old To Be Called That" - it is highly probable that about a million people will have finished a Slim Jim/Cheese Stick Combo in their vehicle right now before you finish this article.

Soon I expect to see sinks, coolers and microwaves available in yuppiemobiles as upscale options - the "Mobile Kitchen Package".

BUMPER STICKERS
Are there any studies correlating bumper stickers with the driver's sanity? Someone's got to do it. Here's my rating system:
1 bumper sticker - concerned citizen
2 bumper stickers - delightfully eccentric
3 bumper stickers - edging toward the dark side
4 bumper stickers - someone's going to get shot
5+ bumper stickers on beat-up, rusty car - poor man's Bondo

TWO JOKES FROM MY MOM (85 years young)
Question: What do the elderly use for birth control?
Answer: Nudity.

A woman told her golf pro, "I was stung by a bee when I was playing golf".
The pro asked, "Where?"
She answered, "Between the first and second hole."
He replied, "Your stance is too wide."


Like this article? Bookmark it at Del.icio.us


To receive these postings hot off the keyboard,
subscribe to poingology, the newsletter


Mark Meshulam offers:
keyboard hotkey shortcuts and screen grabs,
email ticker reminder system,
send large files with FTP and links, all at
www.poingo.com