Include Tag

Root > 3. Customisation

    Follow WiredContact on Twitter

The <#Include...> tag
Is used to place the contents of another file into the location of the <#Include tag in the current template. There are a couple of reasons to use an <#Include tag:
  • You may need the same code in several templates. For example, if you have one report, but you want to have several <#adminhelp file=ReportsSTemplate.html label="static links"> that use different sorting or scoping parameters. In this case, if you coded the report templates to include both the scoping/sorting parameters as well as the data fields/formatting, when you wanted to change the data fields/formatting, you would have to do so for each template. If you use an <#include tag to reference a file with the data fields/formattting, you would only have to change it in one place.
  • You may want to use code in a template that would make the template hard to read and maintain. For example, if you wanted to implement the <#adminhelp file=LookupTemplate.html label=Lookup> exloding views via the <#adminhelp file=AjaxList.html label="Ajax List"> functions, using the <#Include tags make the code in the Lookup.html easier to read/update.
  • You may want portions of a template to display if certain people are logged in, or certain records are displayed. You can use the Evaluate, Level, User, Team, Option, or UserOption parameters to include the file if certain parameters are met.
Primary Parameters
  • Filename=[file path] - the file that has the text that you want to use. The file needs to exist under the WiredContact directory structure. You may use relative paths.
  • Debug - SHow details of tag results in the WiredContact Errors.log file. Use these details to make sure the file path and parameters are correct if items don't display properly.
  • Evaluate=[<#adminhelp file=BooleanPhrase.html label="boolean phrase">] - use to specify criteria that if met, then the file specified in the FileName parameter is used. If the criteria does not evaluate to True, then the file specified in the Else parameter is used, and if no file is specified in the Else parameter, the <#Include tag is ignored. For example,

    <#include evaluate="<#field field=idstatus>=Customer" filename="include\Customer.txt" else="include\NotCustomer.txt">

    If the IDStatus field of the current record is "Customer", then the contents of the "include\Customer.txt" would be used in place of the <#include tag, otherwise, the contents of the "include\NotCustomer.txt" file would be used.

  • Level=x - where x is the level required for passing the Level Test. If the user does not have a Level parameter specified in the user settings, then the Site Default level is used. If there is no Site Default level, 10 is used. The results of the Level test passing or failing is the same as the results of the Evaluate test passing or failing.
  • User=[Username] - If the logged in user matches the Username specified, the user test passes. The results of the User test passing or failing is the same as the results of the Evaluate test passing or failing.
  • Team=[Team Name] - If the logged in user is on the Team specified, the Team test passes. The results of the Team test passing or failing is the same as the results of the Evaluate test passing or failing.
  • option=[option name] - If the Site Settings include a custom setting matching the option name specified, and the value of that settings is "Yes" or "On", then the Option test passes. The results of the Option test passing or failing is the same as the results of the Evaluate test passing or failing. This parameter is useful to allow the system administrator an easy method of including or excluding code in a template without having to edit the templates.
  • Useroption=[option name] - If the User Settings for the logged in user include a custom setting matching the option name specified, and the value of that settings is "Yes" or "On", then the UserOption test passes. The results of the UserOption test passing or failing is the same as the results of the Evaluate test passing or failing.
  • SectionName=[section name] - if you want to use one include file to hold multiple sections of text that will go in on or more templates, then build your include file with sections similar to:

    <#section1>
    Information for Section 1
    <#\section1>
    <#section2>
    Information for Section 2
    <#\section2>
    <#section3>
    Information for Section 3
    <#\section3>

    Then specify the SectionName parameter in your <#Include tag to include only that text within that section. For example,

    <#include evaluate="<#field field=idstatus>=Customer" filename="include\AllInclude.txt" SectionName=Section2>

Add Feedback