Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Vista

Adobe Dreamweaver CS5 : Using Library Items and Server-side Includes (part 6) - Applying Server-Side Includes

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
11/29/2013 1:54:48 AM

5. Applying Server-Side Includes

In some ways, the server-side include (SSI) is the predecessor of the Dreamweaver Library item. The difference between them is that Dreamweaver updates the Web pages with Library items at design time, whereas the server handles the updating with server-side includes at runtime (when the files are actually served to the user). Server-side includes can also include server variables, such as the current date and time (both local and Greenwich Mean Time) or the date on which the current file was last saved.

The Related Files bar makes it much quicker to modify SSI files. Server-side includes linked in the source automatically appear in the Related Files bar. Just click the link to edit immediately in Code view. Start up Live view to see your modifications take effect instantly.


Because server-side includes are integrated in the standard HTML code, a special file extension identifies pages using them. Any page with server-side includes is most often saved with either the .shtml or .shtm extension on Unix servers and .asp or .aspx on Windows servers. When a server encounters such a file, the file is read and processed by the server.

Not all servers support server-side includes. Some Web-hosting companies disable the function because of potential security risks and performance issues. Each .shtml page requires additional processing time, and if a site uses many SSI pages, the server can slow down significantly. Be sure to check with your Web host as to its policy before including SSIs in your Web pages.


Server-side includes are often used to insert header or footer items into the <body> of an HTML page. Typically, the server-side include itself is just a file with HTML. To insert a file, use SSI code like the following:

<!- #include file="footer.html" ->

Note how the HTML comment structure is used to wrap around the SSI directive. This ensures that browsers ignore the code but servers do not. The file attribute defines the pathname of the file to be included, relative to the current page. To include a file relative to the current site root, use the virtual attribute, as follows:

<!- #include virtual= "/main/images/spaceman.jpg" ->

As evident in this example, you can use SSIs to include more than just HTML files — you can also include graphics.

With Dreamweaver's translator mechanism, server-side includes are visible in the Document window during the design process. In Dreamweaver, server-side–include translation is now automatic as long as the Show Contents of Included File option, found in the Invisible Elements category of Preferences, remains enabled.

One of the major benefits of SSIs is that information can be inserted from the server itself, such as the current file size or time. One tag, <! - #echo - >, is used to define a custom variable that is returned when the SSI is called, as well as numerous environmental variables. An environmental variable is information available to the server, such as the date a file was last modified or its URL.

Table 1 details the possible server tags and their attributes.

Table 1. Server-Side–Include Variables
TagAttributeDescription
<! - #config ->errmsg, sizefmt, or timefmtUsed to customize error messages, file size, or time and date displays
<!- #echo ->var or environmental variables such as last_modified, document_name, document_url, date_local, or date_gmtReturns the specified variable
<!- #exec ->cmd or cgiExecutes a system command or CGI program
<! - #flastmod ->file or virtualDisplays the last modified date of a file other than the current one
<! - #fsize ->file or virtualDisplays the size of a file other than the current one
<! - #include ->file or virtualInserts the contents of the specified file into the current one
Other -----------------
- Configuring Startup and Troubleshooting Startup Issues : How to Configure Startup Settings (part 2) - How to Use BCDEdit
- Configuring Startup and Troubleshooting Startup Issues : How to Configure Startup Settings (part 1)
- Configuring Startup and Troubleshooting Startup Issues : Important Startup Files
- Accessing and Using Your Network : Collaborating with Windows Meeting Space (part 2)
- Accessing and Using Your Network : Collaborating with Windows Meeting Space (part 1)
- Accessing and Using Your Network : Working with Offline Files and the Sync Center (part 2) - Synchronizing Offline Files, Handling Synchronization Conflicts
- Accessing and Using Your Network : Working with Offline Files and the Sync Center (part 1) - Working with Network Files Offline
- Accessing and Using Your Network : Sharing Resources with the Network (part 3) - Hiding Shared Resources
- Accessing and Using Your Network : Sharing Resources with the Network (part 2) - Sharing a Resource
- Accessing and Using Your Network : Sharing Resources with the Network (part 1) - Setting Up File and Printer Sharing, Deactivating the Sharing Wizard
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer