# Section Templates ## Overview Section templates are content containers within FirstSpirit pages that add dynamic content to the basic framework defined by page templates. They serve as the primary mechanism for defining input components that will contain dynamic page content such as text, tables, images, datasets, and other content types. ### Key Characteristics - **Purpose**: Add content to the basic framework of a page defined by the page template - **Flexibility**: Multiple section templates can be created for different content types on a single page - **Scalability**: Any number of sections can be added to each section area of a page - **Configuration Similarity**: Section templates function similarly to page templates in their configuration approach ## Section Template Structure Section templates are configured through five main tabs in the SiteArchitect editor: ### 1. Properties Tab Contains all required settings for the template, including: - Template identification and naming - Basic configuration parameters - Template metadata ### 2. Form Tab Defines the input components for the section's content. This is where you specify what types of dynamic content the section will support: - Text input components - Image selectors - Dataset references - Table components - Custom input elements ### 3. Rules Tab Enables conditional logic to influence elements and properties: - Define rules that control template behavior - Set conditions for displaying or hiding elements - Configure property dependencies ### 4. Snippet Tab Controls how the section appears in overview lists: - Define preview representations - Configure snippet display format - Control list view appearance ### 5. Template Set Tab Defines how content appears within the template set framework. See the Template Sets section below for detailed information. ## Creating Section Templates All input components that contain dynamic page content (text, tables, images, datasets, etc.) are defined within a section template. Follow this step-by-step process to create section templates: ### Step 1: Open the Edit Entry View Access the HTML file editor and select the relevant HTML area to trigger an overlay window. ### Step 2: Identify the Target Section Move your cursor within the preview until the correct DIV element is highlighted with a frame border. This visual feedback ensures you're targeting the correct container element. ### Step 3: Access the Add Component Dialog Click the identified entry in the overlay to open the configuration options dialog. ### Step 4: Configure the Component When configuring the section template component: 1. **Assign a descriptive name**: Use meaningful names that describe the content purpose (e.g., "teaser", "hero_section", "article_body") 2. **Select component type**: Choose "Section template" as the component type from the available options 3. **Replace entire HTML tag option**: Leave the "Replace entire HTML tag" checkbox unchecked by default - When checked, this option replaces the entire HTML element with FirstSpirit-specific syntax - In most use cases, this should remain unchecked to preserve the HTML structure ### Step 5: Save and Transfer Click Create to finalize the configuration, then save changes to transfer the component to the Overview tab where it can be further edited and managed. ## Variant Detection The template wizard includes an automatic variant detection feature that recognizes different template variants when the VARIANT component template is enabled in project Settings. ### Benefits of Variant Detection - **Single Template, Multiple Designs**: A single section template can accommodate optional components and multiple design variations - **Reduced Duplication**: Eliminates the need to create separate section templates for similar content with minor variations - **Streamlined Management**: Simplifies template maintenance by consolidating variants into a single template definition ### How It Works When variant detection is enabled: 1. The template wizard automatically identifies variant patterns in the HTML structure 2. Different design variations are recognized and mapped to the same section template 3. Optional components are detected and can be toggled on/off without requiring separate templates ## Input Components for Dynamic Content Section templates define input components for various types of dynamic page content. The Form tab is where these components are configured. ### Common Input Component Types #### Text Components - Rich text editors for formatted content - Plain text fields for simple text input - Multi-line text areas for longer content #### Image Components - Image selectors for media library integration - Image upload interfaces - Image metadata configuration (alt text, captions, etc.) #### Table Components - Data table definitions - Column and row configuration - Cell formatting options #### Dataset Components - References to database content - Dataset query configurations - Related content connections ## Template Sets Template sets are administrator-configured components within FirstSpirit projects that enable content management and processing. ### What Are Template Sets? A unique tab is displayed for each template set added by the administrator for a project in the ServerManager. Template sets provide a framework where developers can check, process, and evaluate entries from the Page Store. ### Primary Function The template set tab serves as a workspace for defining: - Website functionality - Content appearance - Dynamic content processing The most common implementation is the HTML template set, which allows developers to define website output through source code. ### Structural Organization Template set content divides into two distinct regions: #### 1. CMS_HEADER Area The header area is reserved for function definitions such as: - Navigation setup - Dataset output configuration - Function declarations - Variable definitions **Important Note**: `$CMS_(...)` instructions are NOT processed within the CMS_HEADER section. This area is strictly for function definitions. #### 2. Output Area The output area supports: - `$CMS_(...)` instructions for dynamic content - HTML code for structure and layout - FirstSpirit syntax for displaying website content - Template logic and control structures ### Development Features #### Automatic Code Completion The template set editor provides automatic code completion for tags starting with `$`, which streamlines template development by: - Suggesting available FirstSpirit tags - Reducing syntax errors - Improving development speed #### Example Structure ```html $CMS_HEADER( // Function definitions // Navigation setup // Variable declarations )$