Web Development Information |
Server Side Includes (SSI) with ASP
Server Side Includes (SSI) with ASPPeople often have identical sections of code spread throughout many ASP pages, typically code at the top of the page (usually referred to as the header) and the lower part of the page (the footer). Similarly, you may have code that performs a certain set of instructions that you are repeating across multiple pages. Consider an example:- <% Ok, ok... it's simple, but imagine that you used this on multiple pages. What's wrong with this picture? Well... you don't have to think about that long before realising that if you ever wanted to change something about that piece of code, you'd have your work cut out. you would have to change every page... everyone has done this at some stage and luckily most usually take the steps to learn a way around this problem. If we could save our valuable chunk of code into a file and have that file accessed whenever we needed the code, then we no longer have a problem when it comes to changing things, as we simply update one file. Include files or Server Side Includes (SSI) as they are more commonly known are a powerful way to not only save time when it comes to maintaining and updating a site, but also increase efficiency and speed of that site too! Ok, lets see how we use an include file... to start with we need to use one of two methods. The first one allows for including files relatively. By that I mean relative to the directory the ASP file that is using the include file resides. The second method includes files virtually. Including files virtually means that the path is taken from the root directory. Consider that we are going to have a file (/main/somefile.asp) include another file (/includes/someinclude.asp). To demonstrate, relative inclusion, look at this:- <% And here, we give an example of the other method, virtual inclusion:- <% Note the slight difference between the two methods. With virtual inclusion, you can move the file that calls upon the include file anywhere without affecting the outcome, because the path is always relative to the root. The same cannot be said however for relative inclusion. If you move a file that is using relative inclusion to a different directory, you'll most likely find the relative path is no longer correct. From the examples above, you may also notice that both methods, when calling the include do so OUTSIDE of the ASP script block. This because #include declarations are not interpreted by ASP. Include files are included before a single line of ASP is processed which means the following WONT work:- %lt;% We were attempting to perform a dynamic include and I would be the first to admit that the above would be very useful indeed if in fact it were possible. I do intend to cover a few methods that work around this set back but I know you will now be itching to get started right away on using include files to even worry about this, so I will cover it in a future article. I hope that you have found the above informative and hope it inspires you all to write code that's more efficient and more easily maintained. Rob Collyer, experienced with 20 years programming knowledge and site administrator of www.webforumz.com - Copyright 2003-2004
MORE RESOURCES: Unable to open RSS Feed $XMLfilename with error HTTP ERROR: 404, exiting |
RELATED ARTICLES
How to Listen on the Web When building a relationship, listening is more important than talking.A website can reveal a great deal about your business, even answer questions about whom you have done work for in the past. Website For The Company Store If your company own one or more stores, you might be wondering if it would be a good idea to have a website. You might also be wondering if a website for the company store would be profitable for your business. The 5 Biggest Mistakes Almost All Web Designers Make Huge Mistake #1: Creating a Website with Flash -- Did you know in a recent study, top internet marketers discovered that having a website created with Flash, actually DECREASED the response from prospects and customers by as much as three-hundred-and-seventy percent?Here's why: Your prospects and customers are most likely visiting your website using all types of different computers, connection speeds and internet configuration settings.. 2 Key Ways to Make Your Site a Success If one more business owner tells me their website sucks because they're just "too darn busy to deal with it", I'm gonna hurl. That's like saying, "I'm doing business in my dirty underwear because I'm too busy to get dressed. Getting a Web Site Can Be Fast, Easy, and Inexpensive When You Know Your Options So what do you do if need to get a web site but you're not sure how to go about getting one. The good news is you have several options. Make Your Web Site User-Friendly! Making a web site is easy. Making a good web site is not soeasy. Selling Your Site: Outsource or Homemade? To the starting internet entrepreneur, there is nothing more discouraging then the erroneous realization that your dream for a self sufficient business cannot be realized without a heavy investment. This may be why so many people shy away from the internet; seeing all the flashy sites, many of which are $50 templates, people are afraid to enter the world of internet sales and marketing. How to Handle Web Surfers Who Disabled JavaScript There are hundreds of millions of Web surfers today. Each of them uses one of multiple web browsers available now. 3 Ways To Increase Your Websites Conversion rate Everywhere you look these days, people are telling you that in order to sell through your website, you need tons of traffic.Well, even though my business is traffic generation, *I'm* going to tell you that it's a BIG FAT LIE!The secret of a successful website isn't just in the amount of visitors it has; it's in the amount of visitors that are converted to buyers. Improve Conversion Rates - Load Times Your site is getting traffic, but conversion rates are horrible. Everything seems to be working, so what's wrong? Your site may simply be to slow. The Problem with Paypal On Your Web Page When I set up my website I felt paypal was a very simple and easy solution when people wished to purchase my products.For 6 months I was getting 150-200 unique visitors a day, and yet only a few sales every week. Be Creative Before You Purchase Or Create A Website Before you jump into spending coutnless hours on designing and publishing your website, or spending hundreds on having it done by anyone else you should plan out your full design (or structure). This is very important so that when it comes time to do this long-lasting project you will be well prepared. Why Is No-one Buying From My Website? Are you, like many other website owners, frustrated at the amount of time, effort and money you've put into your website, only to see few or no sales?Like most business owners, you probably know your products or services inside out; you know the benefits of them, and what they can give to other businesses or consumers. And you probably paid good money for a website to promote them. Web Development Processes and Technical Environments The process of Web application development is critical to the success of web-based projects. The proper processes can not be enforced unless technical environments are properly setup. Eight Deadly Web Site Mistakes and How to Avoid Them Creating and maintaining an effective presence on the Web has become increasingly complex and challenging as the power of the Internet as a marketing tool becomes more and more necessary to entrepreneurs and emerging businesses.The good news is that technologies that were only available to the big guys just a couple of years ago - audio, video, ecommerce, e-mail database management applications - are now affordable for almost everybody. Creating Compelling Content , Write It and They Will Come In a previous ezinearticles.com article,"I Need real visitors, Not Search Spiders" we discussed the need for content. Web Coach Tip: What You Should Know About DIY Web Sites Recently, a friend asked "What's the deal with those DIY companies that advertise "How to get a website with everything your business needs for under $20 bucks a month?". "How can they do that?" she said. Why Your Brick-and-Mortar Biz Needs A Website The internet has taken over our lives with a vengeance, and has changed the way many of us do business. More and more consumers are now doing their shopping online and, unfortunately, some business owners have felt the pinch. How to Maximize the Value of Every Visitor to Your Website While most marketers are beginning to understand the critical importance of maximizing conversion rates, few are tracking or working to maximize another critical measurement of website effectiveness.Visitor value?Visitor value is simply a representation of how much money you make per visitor to your website. Web Success Secret - Keep Your Visitors Interested Visitors to your site come looking for information or solutions to their problems. They will remain there if they find what they are looking for. |
home | site map | contact us |