Command SECTION Foundation

Sets current output section

Syntax
SECTION <SectionName>
Description

Any output made using the commands ?|??, or the :WriteStr(), :Write() and :WriteRaw() methods goes to the current output section. The default output section of a <CXP/> page is the BODY section. When a page is executed using the:Render() method, the content aggregated in the default BODY section is sent to the client browser.

Using the SECTION command, a section is made the current output section. If the section specified in <SectionName> does not exist, the section is created. Otherwise, the existing section is made current and new content is added to the existing section. Section names are case-insensitive.

The current section aggregates all content subsequently generated using both HTML markup or Xbase++ code. The section remains current until the end of the page, or until another section is made the current output section.

Only the content of the BODY section is output automatically when a page is executed. Page content defined in other sections must be output manually using the RENDER command. Typically, this occurs in a layout file associated with the <CXP/> page. In this case, RENDER is used to selectively output individual sections defined in the content page referencing the layout. For more details see Layout Management.

<h1>My Site Title</h1> 
<p>This goes to the body of my page</p> 
@SECTION Footer 
<p>And this is going to the footer section</p> 
@SECTION BODY 
<p>The end of this page is here</p> 

The previous sample code produces the following output when rendered using the RENDER BODY command in a layout page.

<h1>My Site Title</h1> 
<p>This goes to the body of my page</p> 
<p>The end of this page is here</p> 

The RENDER Footer outputs the content in the Footer section and produces the following output.

<p>And this is going to the footer section</p> 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.