help.axcms.net Axinom Logo

CmsSite.xml

Structure of the CmsSite.xml.

Here you find general information about developing templates. It's necessary to read them first.

XSD-Schemas for CmsSite.xml are available in the Reference.

The file CmsSite.xml consists of sections, which describe:

  • Page Templates
  • Placeholders
  • Structure Elements
  • Channels
  • Html Code Templates
  • Html Rules
  • Image Formats (from 9.1)

Before the version 9.0 there was additionally a section for Dynamic Controls (<DynamicControlsDefinitions>). In the version 9.x there are no dynamic controls, use dynamic structure elements instead.

<CmsSite version="6.0">
    <Channels>...</Channels>
    <HtmlCodeTemplates>...</HtmlCodeTemplates>
    <HtmlRules>...</HtmlRules>
    <ImageFormats>...</ImageFormats>
    <PageTemplates>...</PageTemplates>
    <PlaceholderDefinitions>...</PlaceholderDefinitions>
    <ElementTemplateDefinitions>...</ElementTemplateDefinitions>
</CmsSite>

Page Templates

PageTemplates contains a list of PageTemplate-elements:

<PageTemplate axid="Sample" description="Sample template">
    <File>SampleTemplate.aspx</File>
    <PageType>1</PageType>
    <Placeholders>...</Placeholders>
</PageTemplate>

Attributes:

  • axid – ID of the template, can be a string, has to identify the template uniquely.
  • description – description of the template, visible for users of the AxCMS.net.

Elements:

  • File – name of the aspx-file in relation to the templates-root directory
  • PageType - 1 for page templates, 2 for newsletter templates (default = 1)

Under placeholders is displayed the list of all placeholders used in this template. The list looks like this:

<Placeholders>
    <Placeholder axid="main" type="ContentPlaceholder" /></Placeholders>
  • axid – the ID of the placeholder; it references a placeholder, which is defined under PlaceholderDefinitions.
  • type – always "ContentPlaceholder"; omitting the attributes means a compatibility-mode to former AxCMS.net-versions. There placeholders existed in form of AxTables.

If attaching a placeholder to a template in CmsSite, you also have to use this placeholder in the aspx-file. Vice versa: Using a placeholder in the aspx-file, you have to declare it in the CmsSite.xml within the template-definition.

Placeholder Definitions

PlaceholderDefinitions consist of the definitions of single placeholders:

<PlaceholderDefinition axid="main" description="Content Placeholder">
    <ContentRules></ContentRules>
    <ElementTemplates> ... </ElementTemplates>
</PlaceholderDefinition>

Attributes:

  • axid – unique ID for the placeholder (has to be unique for all placeholders within the AxCMS.net)
  • description – description for the user

Elements:

  • ContentRules – rules defining which content elements can be inserted to this placeholder. If you omit this section, all content is possible. If you define an empty section - no content is possible for this placeholder (you have than to define ElementTemplates).
  • ElementTemplates - a list of all possible structure elements which can be added to this placeholder.

ContentRules contain elements like this:

<Allow atLeast="0" atMost="1000">ControlType</Allow>
  • ControlType: Type of the content-control. can be: AxLabel, AxImage, AxFlashControl
  • atLeast: Minimum number of controls, put 0, if no minimum restriction
  • atMost: Maximum number of controls, must be always provided
  • exactly: Number of controls, which must be inserted (shortcut for the case atLeast=atMost).

<ElementTemplates> consist of single <ElementTemplate>-elements, which refer to the according definition under <ElementTemplateDefinitions> (with axid):

<ElementTemplate axid="1" atLeast="0" atMost="5"/>

axid - unique ID of the ElementTemplate (can only be numeric)

  • atLeast - Minimum number of controls, put 0, if no minimum restriction
  • atMost - Maximum number of controls, must be always provided
  • exactly - Number of controls, which must be inserted (shortcut for the case atLeast=atMost).

Structure Elements

ElementTemplateDefinitions consist of definitions of single ElementTemplates. ElementTemplate is very similar to a page template. It also has a HTML-file as base, which in turn can contain placeholders.

<ElementTemplateDefinition axid="1" description="Teaser-Box">
    <Behaviour>Static,Dynamic,Structural</Behaviour>
    <File>RowControls\teaser.htm</File>
    <Placeholders></Placeholders>
    <Parameters>
        <Parameter>Parameter1</Parameter>
        ...
    </Parameters>
    <TagPrefix>CustomTagPrefix</TagPrefix>
    <TagName>CustomTagName</TagName>
    <IsCompiled>false</IsCompiled>
</ElementTemplateDefinition>

Attributes:

  • axid – a unique ID for ElementTemplates, can only be numeric
  • description – description for the user

Elements:

  • Behaviour - definition about how a control defined by the specified ElementTemplateDefinition should act on a page. There are three possible values for the parameter - Static, Dynamic and Structural. A developer can specify all three or some of them - in that case an end user of the control can choose between those values while inserting the control. If the Behaviour-parameter is not specified, the control's behaviour is determined this way:
    a) if an element is .ascx file, the default behaviour is Static
    b) if an element is not .ascx, then the default behaviour is Structural
  • File - name of the HTML-file in relation to the templates-root-directory
  • IsCompiled - must be false for UserControls and true for custom controls
  • TagPrefix - (Optional) The tag prefix that must be used for this control in the page. If omitted, a unique tag prefix will be generated
  • TagName - (Optional) The tag name for this control. If omitted, a unique tag name will be generated

Html Rules

You can restrict, which elements, which attributes, with which values and in which combinations the Editors may use.

An example for a default rule is:

<HtmlRules>
  <HtmlRule axid="default" tags="strong,b,br,ol,ul,li,hr,u">
   <Tag name="A" attributes="href" styles="default">
    <Attribute name="target" values="_blank, _top, _self, _parent, _media" />
    <Attribute name="track" values="0, 1" />
   </Tag>
   <Tag name="P" attributes="align" styles="default" />
   <Tag name="SPAN" styles="default" />
   <Tag name="FONT" attributes="style, color" />
  </HtmlRule>
  <StyleDefinition axid="default" values="highlight, attention, highlightbold,
attentionbold, articleheadline, linkbold, error">
   <Value value="headline" property="Details.Caption" />
   <Value value="source" property="Details.Origin" />
   <Value value="description" property="Details.Description" />
   <Value value="validon" property="Details.ValidOn" />
   <Value value="validfrom" property="Details.ValidFrom" />
   <Value value="validuntil" property="Details.ValidTill" />
   <Value value="unittestheadline" property="Details.Caption" />
  </StyleDefinition>
  <StyleDefinition axid="rule1styles" values="description,headline" />
 </HtmlRules>

Your rule has an unique axid. All tags that have no attribute can be added directly in "tags" attribute of <HtmlRule> element.
Other tags can be defined as children of <HtmlRule>. They have a name= the tag itself. If they have attributes, that have no defined values, they can be added directly to "attributes"-attribute of <Tag>-tag. If the <Tag>-tag has an attribute "styles", then also "class" is allowed. Inside the "styles"-attribute the according axid of a StyleDefinition is inserted.

All attributes which have defined values can be added as children of <Tag>-tag. They have as name the attribute value and as "values" the allowed values for that attribute. You can also add a "default"-attribute which defines the default value for this attribute.

Styles have an own Element "StyleDefinition". It is needed as style classes can be assigned to certain properties of a page. Each StyleDefintion has an unique axid. All styles which have no assignment can be added in "values"-attribute. The others can be defined as children of <StyleDefinition> element. Please use as property the name of your property. I you need to access a subobject like those from Details-object, separate the names with ".". In this approach you can also add your own developed properties there to be filled automatically.

You can define of course as much rules as you like. There should be one with axid "default", as this applied by default. If you now need a special rule for a special placeholder, create it and in PlaceholderDefinition add its axid like this

<PlaceholderDefinition axid="myplaceholder" description="mydescription" htmlrule="myrule">

Html Code Templates

With Html Code Templates you can define your custom buttons for the text editor. Such a button is associated with a small Html-Snippet, which is inserted into the text when the button is clicked.

<HtmlCodeTemplates>

  <CodeTemplate axid="CompanyName" image="/templates/images/codeicon.gif" hint="Company name">
   <Code>
    <![CDATA[ <b>Test GmbH & Co. KG</b>]]>
   </Code>
  </CodeTemplate>
 </HtmlCodeTemplates>

Your code template should have a unique name, the path to icon should be absolute to root folder and you can add a hint. The code template is then added as own button in text editor. When the user clicks the button, the text defined in <Code>-tag is added at the end of the current text. 

Image Formats

With Image Formats you can define your custom size for image and edit it using tools provided by AxCMS. To enable Image Format functionality in Management System of AxCMS 9.1 and later versions you have to define at least one format in CmsSite.xml file.

<ImageFormats>
  <ImageFormat axid=”myFormat” formats=”JPG,PNG”>
    <Width minSize=”100” maxSize=”300” />
    <Height size=”100” />
  </ImageFormat>
</ImageFormats>

File format can be GIF, JPG or PNG. If two or more file formats are specified, AxCMS.net tries to keep the image in original file format. Otherwise it converts the image to first file format specified. At least one value for “minSize”, “maxSize” has to be specified for width and height. “Size” is a short form of equal values for minSize and maxSize. This change allows specifying content rules for images. Placeholder definitions can define the image format to use: <PlaceholderDefinition axid=”main” imageFormat=”myFormat”>…

When an image is inserted into a placeholder with defined format, it will be automatically formatted. This allows site designers to define the needed dimensions for the pictures placed into some part of the site and prevent breaking design with too big or too small pictures.

Channels

tbd

Read more about using channels under Channels.