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
|
RELATED ARTICLES
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. 4 Marketing Tips for Resourceful Webmasters! The internet is a sea of knowledge. Getting your information to 'float' by the right audience can be like finding that one special grain of sand on the seashore. Paying big bucks for marketing can strain your already limited budget. What is a webmaster to do? Let's discuss four valuable and proven ways to market your site without breaking the bank. Build It and They Will Come Build it and they will come is not always true; you have to form a relationship with the company before you will get quality attendees or participants for a free service. Newsletter Management Using PHP w/o mySQL for Beginners Let's begin by setting some limits. If you're like me, you like to keep it simple. All we're doing is collecting email addresses together for our mailing list, so biochemical engineering is out the window. If you're using Thunderbird (or that MS product), you can send nicely formatted newsletters out and retain all of the other awesome features of your email program so there's really no need for databases, logins, or pretty much anything else. We're going to stay far away from anything non-essential. The Internet Road Map 1) Data Capture 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. Ten Major Tips to Develop a Multilingual Web Site to Work If you are living in a country that its native language is something rather than English language, then you may like to develop your website to offer content in the language of your own country. The Topic Of Your Website The first thing you will have to deal building your website has nothing to do with the web design itself, it's me related to content writing but it must be defined and will effect the rest of your actions. So first of all you need to decide what the topic of your future website is. Topic is very closely connected to another web design issue: keywords. The keywords you select will depend upon the topic you have chosen. When thinking about website topic ask yourself a few questions: What is the goal of the site you are making? What are you trying to achieve with your site. Specify a goal, preferably in one short sentence. 4 Steps to Selling More With Your Web Site Most web sites are more like stage sets than real buildings; they make a good impression and they look substantial at first, but when you open a door, you end up back stage in the dark. They don't generate large numbers of leads, help build relationships with prospects or generate the desired volume of sales. Adding Word Rich Content to Your Website You have permission to publish this article electronically, in print, in your ebook or on your web site, free of charge, as long as the author bylines are included. The Web: Your Window of Opportunity Thinking about starting up a business? The web is the way to go. Look around! More and more, people are relying on the internet as an information resource, a way to foster personal relationships, and method of purchasing goods and services. Server Side Includes (SSI) with ASP People 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:- Earn On Offshore Web Design and Development If you have some experience in web site design and want to make good money you can try acting as IT-outsourcing partner. Learn more what you should know and how to start. Where on Earth is Your Websitee? You've just finished congratulating your marketing team. After six months of concentrated effort you can now actually find your own company web site within the search engines. Everyone is busy handshaking and back patting when a voice from the back of the room rises above the din. "Yeah this is great! Can't wait until we can find ourselves on wireless devices." What Works and What not Works for Your Internet Business "Build it and they will come."--Filed of Dreams (1989) Web Accessibility Myths With more and more countries around the world passing laws about blind and disabled access to the Internet (including the Disability Discrimination Act in the UK), web accessibility has been thrown into the spotlight of the online community. This article attempt to put a stop to the misinformation that has been thrown around and tell you the truth behind web accessibility. The Problem with Automated Accessibility Testing Tools An automated accessibility tool is a piece of software which can test a web page, or even an entire website, for accessibility. Automated accessibility tools are useful because they can save you a huge amount of time. Don't want to check images for alt text on each and every page on your website? Run the site through an automated tester and it'll do it all for you! FREE Amber Alert Tickers for Your Website Project Safekids provides webmasters a valuable tool which could save a child's life. Add our Amber Alert Ticker to your website today. Why Every Small Business Owner Needs Two Websites Every small business owner knows that they need a website, right? Well the truth is what they really need is at least two websites. In Business? 10 Reasons Why You Need a Website -- Now! 1) Word of Mouth The single most powerful form of new business creation is word of mouth. Your past customers, friends, acquaintances and staff aren't likely to carry your brochure or even your business card everywhere they go. The can however carry your domain name, in their heads! Every time they have a conversation that leads to your kind of business they just quote your simple domain name. You've chosen a simple domain name of course, easily remembered, easily spelt and requiring no explanation. For that reason avoid hyphenated names. |
home | site map |
© 2005 |