WebDesignBase (open)
Syntax
LOADLIB "mod::publisher/lib/webdesign.whlib";
OBJECTTYPE WebDesignBaseConstructor
Variables
- STRING assetcachebuster
set a timestamp or other prefix to trigger unique bundles
- STRING baseurl (inherited from WebContext)
The base URL for this page
- STRING canonicalurl
The page canonical URL (eg, it's unique reference in a search engine). This is automatically set to file->url by static pages
- RECORD consiliofields
Additional consilio fields to index with frontend content
- MACRO PTR contentbody
The content body generator (the main body, which is then followed by any plugin adds)
- STRING designcdnrooturl
URL of the CDN version of the design root folder. Passed as 'designcdnroot' to the Witty. If the design-holding site isn't published to a cdn, this just returns designroot
- STRING designrooturl
URL of the design root folder. Passed as 'designroot' to the Witty
- STRING imgrooturl
URL of the image root folder. Passed as 'imgroot' to the Witty (if not set, [imgroot] = [designcdnroot]img/)
- BOOLEAN isstandardcontentpage
If set, we're rendering a 'standard content page' - a builtin page that expects to be able to simply render , etc.
- STRING languagecode (inherited from WebContext)
The language to use (eg 'en', 'nl'), lowercase
- STRING languagecountry (inherited from WebContext)
The country code for the language (eg 'GB', 'US'), uppercase, if set.
- STRING maxcontentwidth
Maximum content width
- STRING navigationtitle
The navigation title (fs_objects.title)
- STRING pagedescription
The page description
- INTEGER pageerrorcode
Error code for which we're running (a 4xx or 5xx code, or 0 for no error)
- STRING pageheading
The page heading (H1))
- STRING pagekeywords
The page keywords
- OBJECT pageobject
The page object (dynamic or static page)
- STRING pagetitle
The page title (SEO title)
- OBJECT pagewitty
The page witty
- STRING pvt_linkmode
- BOOLEAN relativebases
Create relative bases (imgroot, designroot, siteroot), according to the relative scope
- STRING relativelinksscope
The relative link scope (defaults to "protocol", which is safe for multimode http/https sites) used for designfiles and GetRelUrl
- OBJECT rtd_rendering_engine
The RTD rendering engine used by this webdesign and embedded widgets
- RECORD ARRAY structuredbreadcrumb
The structured breadcrumb path, ordered from the root
- RECORD ARRAY structured_data
Structured data, snakecased. Supported since WH 5.9.5+
- STRING wittyencoding
Witty encoding to use
Properties
- PROPERTY assetpack
get the name of the current assetpack
- PROPERTY bodyclasses
BODY classes
- PROPERTY contentnavstops
Content navigation stops, a list of tagnames (eg ['h1','h2']) that will be included in content navigation
- PROPERTY contentobject (inherited from WebContext)
The object providing the source. This will differ from targetobject if targetobject is a contentlink.
- PROPERTY designfolder
Base folder of the design (mod::a/b/c/ ...)
- PROPERTY errorcode (inherited from WebContext)
Current errorcode, if invoked by an error page, eg 404 or 500. May also be 200 (OK), or 0 if the context is unsure about the current error, so we generally recommend checking for ``>= 400`
- PROPERTY htmlclasses
HTML classes
- PROPERTY htmldata
HTML data attributes
- PROPERTY htmldirection
HTML direction
- PROPERTY ispreviewpage
Is this a preview page?
- PROPERTY jsobjconfig
Obj-specific js settings
- PROPERTY jssiteconfig
Site-specific js settings
- PROPERTY metadata (inherited from WebContext)
Object metadata from the relevant content/target object. Added since WH5.8.2 and should generally be used over this->contentobject/targetobject properties
- PROPERTY navigationobject (inherited from WebContext)
The object we've navigated to. The same as the targetobject unless this is an A/B test
- PROPERTY ogsharedescription
Share title property. Adds the opengraph plugin without requiring you to explicitly declare it
- PROPERTY ogshareimage
Share image property. Adds the opengraph plugin without requiring you to explicitly declare it
- PROPERTY ogshareimageresource
Share image resource property. Adds the opengraph plugin without requiring you to explicitly declare it. Setting an image resource is now recommended as it allows WebHare to select proper output format settings. The image source must be a database image.
- PROPERTY ogsharetitle
Share description property. Adds the opengraph plugin without requiring you to explicitly declare it
- PROPERTY pageconfig
The page setup
- PROPERTY resourcedependencies
Extra resource dependencies (for automatic outputtools reload)
- PROPERTY robotstag
Robot meta tag
- PROPERTY seosettings
File seo settings.
- PROPERTY siteconfig
Current site configuration record
- PROPERTY startedrendering
Are we in the rendering phase? (too late to add anything but footers)
- PROPERTY targetapplytester (inherited from WebContext)
The apply tester for the targetobject
- PROPERTY targetfolder (inherited from WebContext)
The folder containing the targetobject, if targetobject is a file. Otherwise, the target object
- PROPERTY targetobject (inherited from WebContext)
The object being published/displayed
- PROPERTY targetsite (inherited from WebContext)
The site containing the targetobject;
- PROPERTY webtoolform
Functions
- MACRO AddPublicationWarning(STRING text)
Generate a publication warning
- MACRO AddResourceDependencies(STRING ARRAY deps)
Add a list of resource dependencies (for automatic reload by outputtools if they have changed)
- BOOLEAN FUNCTION AllowToSkipCaptchaCheck() (inherited from WebContext)
- VARIANT FUNCTION CallWithScope(MACRO PTR callback)
Run the callback inside our context
- MACRO Close()
- STRING FUNCTION ExtractRTDExcerpt(INTEGER fileid, STRING selector, RECORD options)
Extract an excerpt from a RTD file
- STRING FUNCTION GenerateAnchor(STRING intext)
- STRING FUNCTION GetAbsUrl(STRING inurl)
- RECORD FUNCTION GetAssetPackLinks()
- STRING FUNCTION GetDefaultMailTemplate() (inherited from WebContext)
- OBJECT FUNCTION GetFormRenderer()
Get the current form renderer
- RECORD FUNCTION GetInstanceData(STRING ns) (inherited from WebContext)
Get instance data from the relevant content/target object. Added since WH5.8.2 and should generally be used over this->contentobject/targetobject->GetInstanceData()
- STRING FUNCTION GetIntExtLinkTarget(RECORD intextlink)
Generate an link from a RTD or contenttype intextlink record
- INTEGER FUNCTION GetMaximumContentWidthPixels()
Get the maximum content width in pixels
- RECORD FUNCTION GetPageConfig()
Invoked to get the current page configuration
- RECORD FUNCTION GetPageconfigForJS()
- OBJECT FUNCTION GetPlugin(STRING ns, STRING localname) (inherited from WebContext)
- OBJECT ARRAY FUNCTION GetPluginsByFeature(STRING featurename) (inherited from WebContext)
- STRING FUNCTION GetRelURL(STRING inurl)
- MACRO PTR FUNCTION GetRTDBody(RECORD richdoc, RECORD options)
Return a renderer for a RTD from an instance record
- MACRO PTR FUNCTION GetRTDBodyFromFile(OBJECT inputfile, RECORD options)
Return a renderer for a RTD fomr a WHFS object
- RECORD ARRAY FUNCTION GetStaticPages()
Return the pages to render
- RECORD ARRAY FUNCTION GetStructuredBreadcrumb()
Generate a breadcrumb trail useful for structured data. Override this function if you want to overwrite the initial breadcrumb (or just modify this->structuredbreadcrumb in GetPageConfig or later)
- RECORD FUNCTION GetWittyDataForForm(STRING formname, RECORD options) (inherited from WebContext)
- OBJECT FUNCTION GetWRDAuthPlugin() (inherited from WebContext)
- MACRO InsertHTML(STRING htmlcode, STRING location)
Insert a HTML fragment
- MACRO InsertWithCallback(MACRO PTR callback, STRING location)
Insert a callback
- BOOLEAN FUNCTION IsRTDPreview()
- BOOLEAN FUNCTION MatchLanguage(VARIANT languages)
Check if the webdesign is in a specific language
- OBJECT FUNCTION OpenForm(STRING formname, RECORD options) (inherited from WebContext)
- OBJECT FUNCTION OpenRTD(RECORD richdoc, RECORD options)
Open RTD data using an rtdtype
- OBJECT FUNCTION OpenRTDFromFile(OBJECT inputfile, VARIANT options)
Open RTD from WHFS using an rtdtype
- OBJECT FUNCTION OpenWebtoolForm(OBJECT formobject)
Open an external webtool form
- MACRO PrepareErrorPage(INTEGER errorcode, RECORD harescriptinfo, STRING url)
- MACRO PrepareForRendering()
Invoked when pageconfig and pageobject are fully setup
- MACRO PrintErrorPage(INTEGER errorcode, RECORD harescriptinfo, STRING url)
- MACRO PrintSimpleErrorBody(STRING errorclass, STRING errormessage, RECORD errormetadata)
Print a simple error body. Override this if you want to handle some errors differently
- MACRO RegisterHTMLPrefix(STRING addprefix, STRING addnamespace)
Register a prefix on the node
- MACRO RenderRTD(RECORD richdoc, VARIANT options)
Open and render a RTD
- MACRO RenderRTDFromFile(OBJECT inputfile, VARIANT options)
Open and render a RTD from WHFS
- MACRO RenderSharedBlock(RECORD sharedblock)
Render a block from GetSharedBlocks/ResolveLocalSharedBlocks as a widget
- MACRO RenderWidgetInstance(RECORD widgetdata, RECORD options)
Render a widget directly
- STRING FUNCTION RewriteHyperlink(STRING href)
Rewrite a link from a RTD or contenttype data
- MACRO RunAfterStaticPage()
- MACRO RunPage()
- MACRO RunPageWithContents(MACRO PTR contents)
- MACRO SetFrontendData(STRING dataobject, RECORD data)
Data sent to the browser
- MACRO SetJSPluginConfig(STRING pluginname, RECORD data)
- MACRO SetLinkingMode(STRING linkmode)
- MACRO SetPageBuilderData(STRING tag, RECORD data)
Data shared with the pagebuilder (TypeScript web designs)
- MACRO SetupPageWitty()
Initialize pagewitty with the template to use
- RECORD FUNCTION UpdatePageConfig(RECORD pageconfig)
Invoked at last chance to influence the witty variables