Embedded auto templates

It is possible to save any autotemplate file by adding a name. For example:

<Component Name="tplLoginBox" Type="SYS_AutoTemplate_Form" FormName="form1"/>

This will be saved to the autotemplate directory as tplLoginBox. You can then reference this within another template using:

<KTEMPLATE__tplloginbox>

or by inserting the following XML:

<Component Type="SYS_AutoTemplate_IncludeTemplate" ComponentName="tplloginbox" />

This is useful for use with fragments. An example follows.

Example

<!-- Page Functions: Login Box -->
<Fragment Name="frgLoginBox">

   <!-- Data -->
   <DataSource Name="tblPerson" />
   <DataSource Name="LoginBox">
      <Component Type="SYS_Recordset_GetDefaultRecord" />
      <Component Type="SYS_Recordset_SetField" FieldName="Username"
                    Value="{Cookie.DefaultLoginName}" />
   </DataSource>

   <!-- Actions -->
   <FragmentInclude Name="frgBackButton" />
   <Component Name="forgottenpassword" Type="SYS_Button" Section="PR_FormAfterValidation">
      <stuff>
   </Component>

   <Component Name="login" Type="SYS_Button" DefaultButton="1"
                 value="Login >>" Section="PR_FormPassed" >
      <stuff>
   </Component>

   <!-- Forms -->
   <Component Name="formLoginBox" Type="SYS_Form" method="post" />

   <!-- Display -->
   <Component Name="tplLoginBox" Type="SYS_AutoTemplate_Form" FormName="formLoginBox">
      <Component Type="LOCAL_AutoTemplate_BoxWithTitleAndButtons" >
         <Properties Title="Please Login" />
         <Properties Button1Name="backbutton" Button1Image="but-back.gif" />
         <Properties Button2Name="login" Button2Image="but-login.gif" />
         <Component Type="LOCAL_AutoTemplate_RecordListEdit">
            <Properties ComponentName="LoginBox" />
         </Component>
      </Component>
   </Component>
</Fragment>

And its use

<Page PageName="LoginDialog" BaseCacheOn="PageName">
   <FragmentInclude Name="frgSetMenuFrame_UserArea" PageURL="logged-head-existing.html" />

   <FragmentInclude Name="frgLoginBox" />
   
   <Component Type="SYS_Display_Template" TemplateFile="LOCAL_LoginPage">
      <Component Type="LOCAL_AutoTemplate_EcomPageStart" />
      <Component Type="SYS_AutoTemplate_IncludeTemplate" ComponentName="tplloginbox" />
      <Component Type="LOCAL_AutoTemplate_EcomPageEnd" />
   </Component>
</Page>