Class Layout
- Namespace
- Dynamicweb.Rendering.Designer
- Assembly
- Dynamicweb.dll
Represent a layout from a design
public class Layout
- Inheritance
-
Layout
- Inherited Members
Remarks
Instances can only be accessed through Design.Layouts
Properties
Containers
Gets a collection of the content containers present in this layout template
public DynamicElementCollection Containers { get; }
Property Value
CssFiles
Gets the CSS file locations for this layout.
public List<string> CssFiles { get; }
Property Value
DefaultContainer
Gets the default content container present in the layout template - it is the first present in the template
public DynamicElement DefaultContainer { get; }
Property Value
DefaultParagraphTemplate
Gets the default paragraph template of this layout.
public string DefaultParagraphTemplate { get; }
Property Value
- string
- The default paragraph template.
Description
Gets the description of the layout - take from the meta description tag of the layout file, otherwise empty
public string Description { get; }
Property Value
Design
Gets the design that this instance of a layout belongs to
public Design Design { get; }
Property Value
EditorCss
Gets the editor CSS used in backend for the RTE - called ~/Editor.css.
public string EditorCss { get; }
Property Value
- string
- The editor CSS.
File
Gets an instance of TemplateFile object
public TemplateFile File { get; }
Property Value
GridContainers
Gets a collection of content containers present in this layout template that has a grid enabled (grid:true)
public List<GridContainer> GridContainers { get; }
Property Value
- List<GridContainer>
- A list of GridContainer.
HtmlDocument
Gets the HTML document instance (HtmlAgilityPack.HtmlDocument).
[Obsolete("Do not use")]
public HtmlDocument HtmlDocument { get; }
Property Value
- HtmlDocument
- The HTML document.
Name
Gets the name of layout - taken from the layout file title tag if it exists, otherwise name of the template file.
public string Name { get; }
Property Value
Navigations
Gets a collection of navigations present in this layout template
public DynamicElementCollection Navigations { get; }
Property Value
ParagraphTemplates
Gets a collection of paragraph templates for the current layout.
public TemplateFileCollection ParagraphTemplates { get; }
Property Value
Remarks
Looks for templates in a subfolder with the same name as the layout template file (Templates/Designs/Design1/Layout1/Paragraph). If nothing is found, it looks in the current designs folder (Templates/Designs/Design1/Paragraph), then the designs folder (Templates/Designs/Paragraph) and then falls back to the default paragraph template folder (Templates/Paragraph)
ParsedFolder
Gets the full location of the parsed layout folder, i.e. C:\Folder\Files\Templates\Design\Design1\_parsed\
public string ParsedFolder { get; }
Property Value
ParsedFullLocation
Gets the full location of the parsed layout template, i.e. C:\Folder\Files\Templates\Design\Design1\_parsed\Layout.parsed.html
public string ParsedFullLocation { get; }
Property Value
ParsedLocation
Gets the absolute location of the parsed layout template, i.e. /Files/Templates/Design/Design1/_parsed/Layout.parsed.html
public string ParsedLocation { get; }
Property Value
Reparsed
Gets a value indicating whether this Layout was reparsed.
public bool Reparsed { get; }
Property Value
- bool
true
if reparsed; otherwise,false
.
RowContainers
public DynamicElementCollection RowContainers { get; }
Property Value
TemplateFileInfo
Gets a fileinfo object of the layout template
public FileInfo TemplateFileInfo { get; }
Property Value
Methods
get_ParagraphTemplates(DynamicElement)
[Obsolete("Use GetParagraphTemplates instead")]
public TemplateFileCollection get_ParagraphTemplates(DynamicElement container)
Parameters
container
DynamicElement
Returns
GetGridContainerByName(string)
Gets a grid container by its name (id attribute of a dwcontent placeholder with grid:true).
public GridContainer GetGridContainerByName(string containerName)
Parameters
containerName
string- Name of the container.
Returns
- GridContainer
- GridContainer.
if the container does not existnull
GetGridSettingsPath(string)
Finds the grid file location based on the layout. Context aware, see remarks
public string GetGridSettingsPath(string gridFile)
Parameters
gridFile
string- The name of the grid file without any path information, i.e MyGrid.json.
Returns
- string
- A full location path of the grid if found, otherwise
string.empty
Remarks
Looks for the file in these locations and return the first instance: Templates/Designs/Design1/Layout1/Grid, Templates/Designs/Design1/Grid, Templates/Designs/Grid
GetLayoutByLocation(string)
Returns a Layout object based on the relative path to a layout template
public static Layout GetLayoutByLocation(string path)
Parameters
path
string- The relative path to a template, i.e. Design1/Layout.html
Returns
GetLayoutByName(string, string)
Returns a Layout object based on the relative path to a layout template
public static Layout GetLayoutByName(string areaLayoutPath, string layoutName)
Parameters
areaLayoutPath
string- The relative path to the area template, i.e. Design1/Layout.html
layoutName
string- The layout name, i.e. Produts.html
Returns
GetParagraphTemplate(string)
Returns the default paragraph template for a content placeholder
public string GetParagraphTemplate(string containerName)
Parameters
containerName
string- Name of the placeholder
Returns
- string
- A file reference to the paragraph template
GetParagraphTemplatePath(string)
public string GetParagraphTemplatePath(string template)
Parameters
template
string
Returns
GetParagraphTemplates(DynamicElement)
Gets the paragraph templates for a specific container based on the 'limit' setting on the placeholder
public TemplateFileCollection GetParagraphTemplates(DynamicElement container)
Parameters
container
DynamicElement- The DynamicElement representing the container for which the templates has to be returned for.
Returns
- TemplateFileCollection
- The paragraph templates.
Layouts(Design)
Returns a collection of available layouts for a design
public static LayoutCollection Layouts(Design design)
Parameters
design
Design
Returns
- LayoutCollection
- An empty LayoutCollection if no layouts are present