Table of Contents

Class CPLayoutBaseClass

Namespace
Contensive.BaseClasses
Assembly
CPBase.dll

Manage layout records

public abstract class CPLayoutBaseClass
Inheritance
CPLayoutBaseClass
Inherited Members

Methods

GetLayout(int)

get the layout by its id. If not found, returns blank. To determine record status use Layout Model instead.

public abstract string GetLayout(int layoutId)

Parameters

layoutId int

Returns

string

GetLayout(string)

get the layout by its guid. If not found, returns blank. To determine record status use Layout Model instead.

public abstract string GetLayout(string layoutGuid)

Parameters

layoutGuid string

Returns

string

GetLayout(string, string, string)

Returns a layout by Guid. If missing, the layout record is created with the default name and the layout file is transformed (data attribute based html transformations). Layout files are read from privateFiles first; if not found there, cdnFiles is used as a fallback.

public abstract string GetLayout(string layoutGuid, string defaultLayoutName, string defaultLayoutFilename)

Parameters

layoutGuid string

The guid that uniquely identifies the layout record.

defaultLayoutName string

The name to assign to the layout record if it must be created.

defaultLayoutFilename string

The filename (may include a path) of the default html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

Returns

string

The html layout content appropriate for the current platform version.

GetLayout(string, string, string, string)

Returns a layout by Guid. If missing, the layout record is created with the default name and layouts. The default layout is used when platform5 is not appropriate (platform not set, set to 4, platform5 layout is blank). The platform5 layout is used for platform5 (sites set to bootstrap 5 platform). Layout files are read from privateFiles first; if not found there, cdnFiles is used as a fallback.

public abstract string GetLayout(string layoutGuid, string defaultLayoutName, string defaultLayoutFilename, string platform5LayoutFilename)

Parameters

layoutGuid string

The guid that uniquely identifies the layout record.

defaultLayoutName string

The name to assign to the layout record if it must be created.

defaultLayoutFilename string

The filename (may include a path) of the default html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

platform5LayoutFilename string

The filename (may include a path) of the platform 5 (Bootstrap 5) html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

Returns

string

The html layout content appropriate for the current platform version.

GetLayoutByName(string)

Returns the html layout field of a layout record

public abstract string GetLayoutByName(string layoutName)

Parameters

layoutName string

Returns

string

GetLayoutByName(string, string)

Returns the html layout field of a layout record. If the record does not exist, it is created with the supplied default layout

public abstract string GetLayoutByName(string layoutName, string defaultLayout)

Parameters

layoutName string
defaultLayout string

Returns

string

Transform(string)

Transform the input html using the data attribute based html transformations. These transformations are typically used to convert a static html design

data-mustache-section data-mustache-inverted-section data-body data-layout data-href data-value data-src data-alt data-addon data-innertext data-delete data-mustache-value data-mustache-variable

public abstract string Transform(string sourceHtml)

Parameters

sourceHtml string

Returns

string

processImportFile(string, ImporttypeEnum, int, int, int, int, ref List<string>)

Import a file and process the html. Save the result.

public abstract bool processImportFile(string htmlSourceTempPathFilename, CPLayoutBaseClass.ImporttypeEnum importTypeId, int layoutId, int pageTemplateId, int emailTemplateId, int emailId, ref List<string> userMessageList)

Parameters

htmlSourceTempPathFilename string
importTypeId CPLayoutBaseClass.ImporttypeEnum
layoutId int

If not 0, the imported html will be saved to the record in this table.

pageTemplateId int

If not 0, the imported html will be saved to the record in this table.

emailTemplateId int

If not 0, the imported html will be saved to the record in this table.

emailId int

If not 0, the imported html will be saved to the record in this table.

userMessageList List<string>

If there were any processing errors caused by the data, return them here. These can be presented to the user.

Returns

bool

processImportFile(string, ImporttypeEnum, int, int, int, int, ref List<string>, int)

Import a file and process the html. Save the result.

public abstract bool processImportFile(string htmlSourceTempPathFilename, CPLayoutBaseClass.ImporttypeEnum importTypeId, int layoutId, int pageTemplateId, int emailTemplateId, int emailId, ref List<string> userMessageList, int layoutFrameworkId)

Parameters

htmlSourceTempPathFilename string
importTypeId CPLayoutBaseClass.ImporttypeEnum
layoutId int

If not 0, the imported html will be saved to the record in this table.

pageTemplateId int

If not 0, the imported html will be saved to the record in this table.

emailTemplateId int

If not 0, the imported html will be saved to the record in this table.

emailId int

If not 0, the imported html will be saved to the record in this table.

userMessageList List<string>

If there were any processing errors caused by the data, return them here. These can be presented to the user.

layoutFrameworkId int

if 5, import layout as framework 5, else default

Returns

bool

updateLayout(string, int, string, string)

The layout record is created or updated with the default name and layout record. Layout files are read from privateFiles first; if not found there, cdnFiles is used as a fallback.

public abstract void updateLayout(string layoutGuid, int layoutContentId, string defaultLayoutName, string defaultLayoutFilename)

Parameters

layoutGuid string

The guid that uniquely identifies the layout record.

layoutContentId int

Set to a contentid if this layout should be created in a different segment of Layouts, like 'layouts for CTA'. Use cp.content.getid("layouts for CTA") to determine the contentId.

defaultLayoutName string

The name to assign to the layout record if it must be created.

defaultLayoutFilename string

The filename (may include a path) of the default html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

updateLayout(string, int, string, string, string)

The layout record is created or updated with the default name and layout record. Layout files are read from privateFiles first; if not found there, cdnFiles is used as a fallback.

public abstract void updateLayout(string layoutGuid, int layoutContentId, string defaultLayoutName, string defaultLayoutFilename, string platform5LayoutFilename)

Parameters

layoutGuid string

The guid that uniquely identifies the layout record.

layoutContentId int

Set to a contentid if this layout should be created in a different segment of Layouts, like 'layouts for CTA'. Use cp.content.getid("layouts for CTA") to determine the contentId.

defaultLayoutName string

The name to assign to the layout record if it must be created.

defaultLayoutFilename string

The filename (may include a path) of the default html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

platform5LayoutFilename string

The filename (may include a path) of the platform 5 (Bootstrap 5) html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

updateLayout(string, string, string)

The layout record is created or updated with the default name and layout record. Layout files are read from privateFiles first; if not found there, cdnFiles is used as a fallback.

public abstract void updateLayout(string layoutGuid, string defaultLayoutName, string defaultLayoutFilename)

Parameters

layoutGuid string

The guid that uniquely identifies the layout record.

defaultLayoutName string

The name to assign to the layout record if it must be created.

defaultLayoutFilename string

The filename (may include a path) of the default html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

updateLayout(string, string, string, string)

The layout record is created or updated with the default name and layout record. Layout files are read from privateFiles first; if not found there, cdnFiles is used as a fallback.

public abstract void updateLayout(string layoutGuid, string defaultLayoutName, string defaultLayoutFilename, string platform5LayoutFilename)

Parameters

layoutGuid string

The guid that uniquely identifies the layout record.

defaultLayoutName string

The name to assign to the layout record if it must be created.

defaultLayoutFilename string

The filename (may include a path) of the default html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.

platform5LayoutFilename string

The filename (may include a path) of the platform 5 (Bootstrap 5) html layout file. The filename-only portion is used to read from privateFiles; the full value is used to read from cdnFiles as fallback.