Command RENDER Foundation

Renders a specific section

Syntax
RENDER <SectionName> 
RENDER BODY
RENDER SCRIPTS
Description

The RENDER command is used in layout files to specify the location in which a specific page section is rendered. If a layout file is referenced in a page, page composition is defined in the layout file. In this case, the RENDER command must be used to selectively render the output defined in the content page. To do this, the name of the section must be specified.

By default, output of a content page is written to the BODY section. Therefore at least the RENDER BODY command has to be used in the layout file. Otherwise the output of the content page is lost.

Section names are case-insensitive. If the <SectionName> does not identify a section, the composition engine writes an HTML comment to the output as shown below:

<!-- Informational: RenderSection() used to write an unknown section [SectionName]! --> 

Sample layout file ("simplesite.layout")

<html> 
<head> 
<title>MySite by @(Version())</title> 
</head> 
<body> 
<div style="font-size:18pt;background-color:#ff0000;color:#efefef;"> 
MyApplication 
</div> 

<!--- output from content page is rendered here --> 
@RENDER Body 
<div style="font-size:8pt;background-color:#0000ff;color:#efefef;"> 
  <!--- If the content page has defined a section with the name --> 
  <!--- "Footer", this section gets rendered here!              --> 
  @RENDER Footer 
</div> 
</body> 
</html> 

CXP Page with layout reference ("layout1.cxp")

<!-- We need to reference the layout file to make use of it --> 
<%#page layout="./simplesite.layout" %> 

<!-- Here we just define the content for the body --> 
<h2>This text and the text in the footer are defined in page layout1.cxp</h2> 
<h3>The heading, colors and the overall page structure are defined 
in the layout file simplesite.layout</h3> 

<!-- Now we declare and switch to another section named Footer --> 
<!-- Subsequent HTML markup or output is collected now in the  --> 
<!-- Footer section instead of the body                        --> 
@SECTION Footer 
<p>Nothing special today</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.