How To Incorporate "Include" Files Into 20/20 DataShed's Pages

To SSI or Not To SSI?

We recommend that you do not use the traditional SSI syntax with 20/20 DataShed but instead use the Server.Execute() method. The traditional #include syntax looks like this:

<!--#include file="a-file.asp"-->
or
<!--#include virtual="a-file.asp"-->

We recommend that you avoid the #include directives demonstrated above.

"Why?" you might ask.

  1. Because this type of #include command is processed before the page is executed and that prevents (or limits) 20/20 DataShed's ability to execute your "included" ASP code conditionally. While the Server.Execute() method allows the opportunity to call extraneous code after the ASP page processing has started -- this is ideal within 20/20 DataShed's framework.
  2. Because this type of #include command almost certainly requires that you make modifications to 20/20 DataShed's ASP source files. This is not ideal as it prevents you the ability to smoothly upgrade if/when we release updates to the product.

The Server.Execute() method offers other benefits too:

...and the best part is...

20/20 DataShed contains a hook in its skinning engine which will execute your own code whenever, wherever you want! You merely have to:

  1. Create the ASP script that you want to execute,
  2. then put a little token in your template.html file to tell 20/20 DataShed where you want the content to appear on your pages.

Do We Practice What We Preach?

Yes, and no. We use both methods. Obviously, traditional SSI syntax is still very powerful and indeed 20/20 DataShed uses the #include directives generously throughout the product.

However we feel that the Server.Execute() method is the best available option for those who want to author their own scripts, plug-ins, extensions, etc. to extend 20/20 DataShed's features. For instance, when we develop plug-ins or add-ons for 20/20 DataShed, we have quite a strict policy that the core product should not be altered in any way to accomodate the additional feature(s) -- and to accomplish that goal we have found the Server.Execute() method to be extremely useful. That experience leads us to this conclusion: you should use the Server.Execute() method instead of the #include directive.

Well, More Rock and Less Talk, eh? Let's Get Started...

Tutorial #1: A Copyright Notice for Your Web Site

Let's create a simple script which will write a single line of HTML to the pages of your web site: Like this:

Copyright © 2002 - Your-Company. All rights reserved.

To demonstrate how easy this is, we'll begin with this very simple (but also quite practical) script.

In this tutorial, we will perform the following actions:

  1. Create a new .asp page that 20/20 DataShed (or any other ASP page/product) can execute. The new script will output a simple copyright message.
  2. Explanation of the code in this basic example.
  3. Edit the template.html to instruct 20/20 DataShed when/where to execute the new ASP script.
  4. And last, if you have other ASP pages in use on your web site then we'll show you how to execute this new script from those other pages.

More Tutorials

This tutorial was extended in our online forum when a customer asked how a plug-in could be created to display the current number of items in the database. That conversation is a great "next-step" to this tutorial and is located here.

Other examples of this technique can be seen in the related topics below. If you would like to see a tutorial about a specific topic, please let us know.

Related topics


© 2005 - 2007 20/20 Applications. All rights reserved.