Main Menu
| Home |
| Web Design |
| Web Development |
Latest News
- Website Content Development Made Easy - Seriously
- How to Capitalize on Free Content From Podcasts
- Getting Back to Basics With Your Website
- Why Every Brick and Mortar Business Needs a Web Site
- Need a Website? 3 Questions You Should Know Before Doing-It-Yourself Or Before Hiring a Web Designer
- The Importance of Using Keywords in Your Content
- Creating Your Own Business Website
- .Net Dynamic Web Portal Development
- Multimedia Presentations - The New Way to Web Development
- Create a Website - Who Me?
- How Do You Check a Website Before You Buy It?
- Computer Work From Home Jobs - You Can Put Your Web Design Skills to Work
- Website Designing Company in Vancouver
- Maintenance For Website - 3 Important Tests
- Thinking About Getting Website Design Software?
| Conditional SSI |
|
While many of you are familiar with SSI (Server Side Includes) and its tremendous usefulness as a server feature, did you know that the technology supports conditions? Imagine being able to give your SSI code logic, so it executes different commands, depending on variables such as browser type, time of day, referring URL, and whatever else can be accessed and compared in Perl. Something like that would be nothing less than revolutionary, and fortunately, possible! Just to review, SSI are "codes" you place on your page that the server picks up and executes. The most common use of SSI is to include a file on the page: [an error occurred while processing this directive] The above command will cause the file "afile.htm" to be inserted and displayed, as if it were manually added to the page.
While many of you are familiar with SSI (Server Side Includes) and its tremendous usefulness as a server feature, did you know that the technology supports conditions? Imagine being able to give your SSI code logic, so it executes different commands, depending on variables such as browser type, time of day, referring URL, and whatever else can be accessed and compared in Perl. Something like that would be nothing less than revolutionary, and fortunately, possible! Just to review, SSI are "codes" you place on your page that the server picks up and executes. The most common use of SSI is to include a file on the page: [an error occurred while processing this directive] The above command will cause the file "afile.htm" to be inserted and displayed, as if it were manually added to the page. Adding Condition to the Mix
They work as you would expect with any if/else statements. In JavaScript, the above would be equivalent in logic to "if", "else if", and "else", respectively. The last command is an odd ball; it serves no particular purpose except that's it's needed at the end of each conditional SSI definition. Take a look at the following example, which embeds two different files onto the page, depending on whether the user is using Internet Explorer or not: [an error occurred while processing this directive] Output:
Got your attention now, didn't I? By using conditional SSI, with the environmental variable HTTP_USER_AGENT as the condition to test for, the above example allows us to display browser specific content in such a versatile way that no client side language (such as JavaScript) can match. It's SSI with a brain baby!
[an error occurred while processing this directive]
Output:
If you're not familiar with Perl programming, then parts of the above code undoubtedly look alien to you. Without this being a Perl tutorial, in a nutshell, regular expressions is used to extract out the relevant browser info in HTTP_USER_AGENT. The variable contains the following: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 Use a different browser, and note the difference in the output. In Conclusion
|
| < Prev | Next > |
|---|
My links
Popular
- Importance of Website Development for a Company
- Techniques in Web Development
- Are You Considering Building A Website?
- Do You Want To Create A Website Or A Business Online?
- Are You Vying For Open Source Web Development?
- Web Site Development Company
- Importance of Web Site Content Development
- Four Easy Steps For Building A Website
- Ruby on Rails Framework for Java Technology Developers
- Top 5 Reasons to Start a Web Business If You Are an Athlete or Coach
- Everyone Is Talking Web 2.0 Development
- Overcoming Those Annoying CSS Bugs
- Target Your Market - Get Your Website To Speak To Your Niche
- Easy Web Programming Languages Are Coming
- What To Look For When Hiring A Webmaster?
