393 users using DBSP now!
home -> documentation -> language reference -> INCLUDE Tag


Description

The INCLUDE command allows you to replace the tag with the contents of another file at the time when file is sent out by the server.


Syntax

<#INCLUDE DOC="document"/>


DOC Specify in document the file that will be inserted instead of the INCLUDE tag.


Applications

Suppose that you have 100 files on your web application. At the top of each of the files you need to present some information that changes daily. You could either go into every page, every day and change the information or you could have a text file that each of your 100 files include. Then you would change just that one text page and all the other pages would update.



Code examples

Example 1. Creating a common header for several pages.

The following example shows you how to create a header file and use it inside several pages.

Source code

examples/header1.dbsp

welcome!... this is the header of all the documents.



examples/header2.dbsp

  
     header example
  
  
     <#include doc="header1.dbsp"/>
    
   

this is the body of the document.


     
  


Test example