Logo
HOW TO
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Vista

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

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
 
 
REVIEW
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

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

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
 
VIDEO TUTORIAL
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
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 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
Top 10
- Microsoft Excel : How to Use the VLookUp Function
- Fix and Tweak Graphics and Video (part 3) : How to Fix : My Screen Is Sluggish - Adjust Hardware Acceleration
- Fix and Tweak Graphics and Video (part 2) : How to Fix : Text on My Screen Is Too Small
- Fix and Tweak Graphics and Video (part 1) : How to Fix : Adjust the Resolution
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro