<xmod:Include>
<xmod:Include> reads the file at FileName and writes its contents into the rendered output verbatim. Use it to share a common header, footer, or HTML fragment across multiple views — change the file once and every view that includes it picks up the change.
Unlike most XMP tags, <xmod:Include> doesn't have to live inside a <xmod:Template> — you can place it anywhere in the view file, including before or between templates. It is not data-bound.
Use sparingly
Each <xmod:Include> is a separate disk read every time the view renders. For most pages, one or two includes is fine. If you need the same fragment dozens of times in one view, consider duplicating the markup or moving it into a <xmod:ScriptBlock> (which has a RegisterOnce deduplication option).
Trust the contents
The file is rendered verbatim — no escaping, no sanitization, no XMP processing of tags or tokens inside the file. Only include files whose contents you control.
Example
You might keep a site-wide header in ~/includes/CompanyHeader.html:
<h1>DNNDev.com</h1>
<p><em>Makers of Cool DNN Tools since 2004</em></p>Reference it from any view:
<div>
<xmod:Include FileName="~/includes/CompanyHeader.html" />
<xmod:Template Id="Employees">
<DetailDataSource CommandText="SELECT * FROM Employees WHERE EmployeeId = @EmpID">
<Parameter Name="EmployeeId" Value="[[Url:eid]]" DataType="Int32" />
</DetailDataSource>
<DetailTemplate>
<h1>[[FirstName]] [[LastName]]</h1>
<div>[[Bio]]</div>
</DetailTemplate>
</xmod:Template>
</div>If the company name changes, update CompanyHeader.html once and every view that includes it picks up the new value.
Properties
| Property | Values | Default | Description |
|---|---|---|---|
| FileName * | path | Path to the file whose contents should be included |
* Required property
Property Details
FileName: A path to a file on the web server. Use a tilde (
~) prefix for paths relative to the site root, or an absolute virtual path. Examples:Form Example Tilde (site root) ~/includes/CompanyHeader.htmlAbsolute virtual path /Portals/0/myfile.txtThe file's contents are written into the response stream as-is. XMP tags and tokens inside the file are not processed.