The following information is intended for advanced users.
The Site object provides access to all the properties in the SDF file as well as some useful methods that make it easier to process template files.
The Site object is used frequently, and for that reason, Second Site provides the following two shortcuts:
- You do not have to specify the object name when you refer to a Site object property or method. So, "Site.Wrapper" and "Wrapper" are synonymous.
- Some of the most frequently used SDF file properties may be accessed through special properties rather than through the Item property. They are described below in the Shortcut Properties section.
For general instructions on using script statements, see the Script Usage page.
Returns the value of the specified property. The property parameter must include the section name and property name separated by a period as in "sectionName.propertyName".
The compiler name is <%=Item("Compiler.Name")%>.
Scripts should always use shortcut properties rather than their Item(...) equivalents. All of the shortcut properties are read-only; you may not set the value of the underlying property using the shortcut.
Same as Item("Build.Date").
Same as Item("Build.Time").
Same as Item("Build.Count").
Same as Item("Site.Description").
Same as Item("Site.SubTitle").
Same as Item("Site.Title").
Returns the text in string minus any HTML tags. Does not remove entity codes, e.g., does not remove , etc.
Returns the contents of the specified file.
You may use a relative filepath, in which case the path is evaluated relative to the Input (-i) folder. You may also use an absolute filepath.
If you use the Include() function, I suggest that you create an include sub-folder in your Input (-i) folder. Second Site skips the include folder when copying files and folders to the Output (-o) folder. Putting files in the include folder means they will not be copied to the Output folder except as a result of Include() statements.
If you use backslashes in the filepath, you must double each backslash as shown in the examples below. Script statements are usually entered in User Item text or static content properties, and backslashes are given special treatment there.
Relative FilePath Examples
For the following examples, assume the Input folder is
Returns true if a file with the specified filename exists in the Input (-i) folder.
Returns true if a file with the specified filename exists in the Output (-o) folder.
It's convenient to store the XML and XSL files in the include folder:
See the Transform() Function Example.
Wrapper(prefix, value, suffix)
If value is empty, Wrapper returns an empty string. If value is not empty, Wrapper() returns the concatenation of the three arguments.
A common use of Wrapper() is to include HTML code around properties that may be empty. if the property is empty, Wrapper() suppresses the HTML code.
This page last changed on 16 Jan 2011.