Site development/webdesign
- Webdesign
- Author mode
- Frontend
- Using NPM with WebHare
- Adding analytics or tag manager
- Consenthandling
- Language files
- Dynamic webpages
- WHFS Register
- Error pages
- WHFS and History
Webdesign
- OBJECTTYPE DynamicPageBase
Older base class for static pagetypes (new pages should use WebPageBase)
- VARIANT FUNCTION GetAdhocCached(RECORD cachetag, MACRO PTR cachegetter, RECORD options)
Get a value from cachegetter, first looking at a cache (every calling whlib has its own cache)
- STRING FUNCTION GetAssetPackBuildVersion(STRING bundletag)
Get the build version of an assetpack bundle
- RECORD FUNCTION GetDynamicPageParameters()
Return parameters of the dynamic page
- RECORD FUNCTION LookupAdhocCached(RECORD cachetag)
Lower level api: lookup a value in the cache
- OBJECTTYPE SimpleWebPage
A simple webpage that renders the specified body
- OBJECTTYPE StaticPageBase
Base class for static pagetypes
- MACRO StoreAdhocCached(RECORD cachetag, RECORD storevalue)
Lower level api: store a value directly in the cache
- OBJECTTYPE WebDesignBase
- OBJECTTYPE WebDesignPluginBase
Base object for webdesign plugins such a
<wrdauth>
- OBJECTTYPE WebPageBase
WebHare Filesystem (WHFS) and Sites
- OBJECT FUNCTION CreateSiteFromFolder(INTEGER rootfolderid)
Converts a WHFS folder into a site
- RECORD FUNCTION DescribePreviewRequest()
Describe the current preview request (for pages)
- RECORD FUNCTION FindFile(INTEGER fileid)
Find a file by its ID
- RECORD FUNCTION FindFileByFullPath(INTEGER siteid, STRING fullpath)
Find a file by its full path
- RECORD FUNCTION FindFileByName(INTEGER parentid, STRING filename)
Find a file by its name
- RECORD FUNCTION FindFolder(INTEGER folderid)
Find a folder by its ID
- RECORD FUNCTION FindFolderByFullPath(INTEGER siteid, STRING fullpath)
Find a folder by its full path
- RECORD FUNCTION FindFolderByName(INTEGER parentid, STRING foldername)
Find a folder by its name
- RECORD FUNCTION FindSite(INTEGER siteid)
Find a site by its ID
- RECORD FUNCTION FindSiteByName(STRING sitename)
Find a site by its name
- RECORD ARRAY FUNCTION FindWHFSObjectReferences(RECORD searchoptions)
Search for objects of types or referring to objects or instances of certain types
- STRING FUNCTION GetABTestVariantLink(INTEGER navigationobject, INTEGER targetobject)
Get a link that will show a specific A/B test variant
- STRING FUNCTION GetAssetpackIntegrationCode(STRING assetpack, RECORD options)
- RECORD FUNCTION GetAssetPackLinks(STRING assetpack, RECORD options)
- RECORD FUNCTION GetContentFileTypeProps(INTEGER filetype, INTEGER filelinkid)
Check file type properties, following linked files if necessary
- STRING FUNCTION GetFileSubpageURL(INTEGER fileid, STRING pagename)
Create a link to a published file's subpage
- RECORD FUNCTION GetFileTypeProps(INTEGER gettype)
Check file type properties
- RECORD ARRAY FUNCTION GetFolderTree(INTEGER folderid)
Returns an array of folder records from the root to the specified folder
- INTEGER ARRAY FUNCTION GetFolderTreeIDS(INTEGER folderid)
Returns an array of folder IDs from the root to the specified folder
- STRING FUNCTION GetIntextlinkTarget(RECORD intextlink)
Get the destination of an internal/external link field
- RECORD FUNCTION GetPhotoalbumProps(INTEGER folderid)
Gets the photo album properties a photo album folder
- STRING FUNCTION GetPreviewLink(INTEGER fsobject, RECORD options)
Get a preview link for a page
- OBJECT FUNCTION GetPublicDraft(INTEGER objid)
Returns the public draft for this object, if it exists
- BLOB FUNCTION GetPublishedDBFile(INTEGER objectid, STRING findfilename)
Get a file stored by CreateDBFile
- RECORD ARRAY FUNCTION GetPublishedDBFiles(INTEGER ARRAY objectids, STRING filenamemask)
Get multiple database-published files
- BLOB FUNCTION GetRichDocumentAsHtmlFragment(RECORD indata)
Format a whfs instance rich document
- STRING FUNCTION GetViewURLWithFeedback(OBJECT file, OBJECT tolliumuser)
- RECORD FUNCTION GetWHFSFileDirect(INTEGER fssettingid)
Returns a file record directly from a WHFS setting
- RECORD FUNCTION GetWHFSInstanceDirect(INTEGER64 fssettingid, RECORD options)
Reads an WHFS instance from its setting ID
- BOOLEAN FUNCTION IsDeletedObjectAccessible(INTEGER objectid)
- BOOLEAN FUNCTION IsFolderAncestorOf(INTEGER parentid, INTEGER childid)
Check if a folder is a parent or ancestor of another folder
- BOOLEAN FUNCTION IsValidWHFSName(STRING filename, BOOLEAN allowslashes)
Check if a filename is acceptable
- INTEGER FUNCTION LookupInWHFSRegister(STRING slotfullname)
Look up a WHFS register entry
- RECORD FUNCTION LookupPublisherURL(STRING url, RECORD options)
Find the (closest) file associated with a URL on this server
- RECORD FUNCTION MakeIntExtExternalLink(STRING href)
Create an intextlink record for an external link
- RECORD FUNCTION MakeIntExtInternalLink(INTEGER fsref, STRING append)
Create an intextlink record for an internal link
- OBJECT FUNCTION OpenSite(INTEGER siteid)
Opens the site object for a site from the id of the site
- OBJECT FUNCTION OpenSiteByName(STRING sitename)
Opens the site object for a site given its name
- OBJECT FUNCTION OpenWHFSObject(INTEGER findid, RECORD options)
Returns a WHFS file or folder object from the id of the object. Returns DEFAULT OBJECT for id 0, use OpenWHFSRootObject to open the root folder object.
- OBJECT FUNCTION OpenWHFSObjectByPath(STRING fullpath, RECORD options)
Returns a WHFS file or folder object from the whfs path of the object.
- OBJECT FUNCTION OpenWHFSPrivateFolder(STRING modulename)
Open a module's private data folder
- OBJECT FUNCTION OpenWHFSRootObject()
Returns the WHFS folder object of the root folder
- OBJECT FUNCTION OpenWHFSType(STRING getnamespace, RECORD options)
Returns a WHFS type object from the namespace of the type
- OBJECT FUNCTION OpenWHFSTypeById(INTEGER getid)
Returns a WHFS type object from the id of the type
- RECORD FUNCTION ParsePreviewURL(STRING url)
- MACRO RemoveSiteFromFolder(INTEGER rootfolderid)
Converts a site into a normal folder
- MACRO RepublishWHFSObjectReferences(RECORD ARRAY references)
Schedules the result of a FindWHFSObjectReferences for publication
- RECORD ARRAY FUNCTION SearchRecycleBin(RECORD options)
Returns a selection of the recycle bin
- OBJECTTYPE SiteObject
WHFS site object
- RECORD FUNCTION TestSiteOutputAvailability(INTEGER forsiteid, INTEGER newoutputweb, STRING newoutputfolder)
Test a site output availability
- MACRO TryRedirectUsingURLHistory(RECORD options)
Redirect if a history URL is available. This function is intended for custom 404 pages
- OBJECTTYPE WHFSException
Exception thrown by WHFS functions
- OBJECTTYPE WHFSFile
WHFS file object
- OBJECTTYPE WHFSFolder
WHFS folder object
- OBJECTTYPE WHFSType
This objecttype is the base class for file and foldertypes in WHFS
Dynamic web pages
- MACRO AbortWithHTTPError(INTEGER errorcode, STRING reason, RECORD options)
Abort with the specified HTTP error
- MACRO AddHTTPHeader(STRING header, STRING data, BOOLEAN always_add)
Add a HTTP header
- MACRO CloseWebSession(STRING sessid, STRING scope)
End a session, deleting any data stored for the session
- STRING FUNCTION CreateWebSession(STRING scope, RECORD sessdata, VARIANT ARRAY args)
Create a new session
- MACRO ExecuteSubmitInstruction(RECORD instr)
Execute a submit instruction
- RECORD FUNCTION FlushWebResponse(DATETIME waituntil)
Flush all server output so far (EXPERIMENTAL!)
- MACRO FlushWebserverLogfiles()
Flush the webserver log files
- STRING FUNCTION FormatHttpDateTime(DATETIME whattime)
Formats a datetime in the HTTP required format
- RECORD ARRAY FUNCTION GetAllWebCookies()
Get all cookies
- RECORD ARRAY FUNCTION GetAllWebHeaders()
Get all request headers
- RECORD ARRAY FUNCTION GetAllWebVariables()
Get all query variables
- INTEGER FUNCTION GetClientBinding()
Get the ID of the port the client connected to
- STRING FUNCTION GetClientLocalAddress()
For virtual hosting, returns the hostname of the webserver, otherwise the IP of the server webserver the client connects to.
- STRING FUNCTION GetClientLocalIp()
Get the ip the client connects to
- INTEGER FUNCTION GetClientLocalPort()
Get the port the client connects to
- STRING FUNCTION GetClientRemoteIp()
Get the ip the client connects from
- INTEGER FUNCTION GetClientRemotePort()
Get the port the client connects from
- STRING FUNCTION GetClientRequestURL()
Get the requested URL
- INTEGER FUNCTION GetClientWebserver()
Get the ID of the webserver the client connects to
- STRING FUNCTION GetDecryptedWebCookie(STRING name, STRING secretkey)
Get an encrypted cookie from the client
- BLOB FUNCTION GetRequestBody()
Get the full undecoded request body
- STRING FUNCTION GetRequestMethod()
Get the HTTP request method used in this request
- STRING FUNCTION GetRequestURL()
Get the requested URL
- STRING FUNCTION GetSignedWHDebugOptions(STRING ARRAY opts)
Generate a signed debug setting string, suitable for the wh-debug cookie
- RECORD FUNCTION GetUploadedFile(STRING token)
Retrieve an uploaded file by its token
- RECORD ARRAY FUNCTION GetWebAcceptLanguage()
Get and parse the accept-language header
- BLOB FUNCTION GetWebBlobVariable(STRING name)
Return file from the query
- STRING FUNCTION GetWebCookie(STRING name)
Get a cookie from the client
- STRING FUNCTION GetWebHeader(STRING name)
Return the header from the http request
- STRING FUNCTION GetWebOriginURL(STRING path)
Get request's origin URL
- STRING FUNCTION GetWebserverDebugCookie(STRING ARRAY opts)
Generate the debug cookie for the webserver
- RECORD FUNCTION GetWebSessionData(STRING sessid, STRING scope)
Get session data from an active session, extending its lifetime if necessary
- STRING FUNCTION GetWebVariable(STRING name)
Return a variable from the query
- STRING FUNCTION GetWebVariableFilename(STRING name)
Get the filename of an uploaded file, if available
- INTEGER FUNCTION GetWebVariableLength(STRING name)
Get the total length of the contents of a variable
- BOOLEAN FUNCTION IsRequest()
Are we in a dynamic page?
- BOOLEAN FUNCTION IsRequestPost()
Check whether the current HTTP request was a POST request
- BOOLEAN FUNCTION IsWHDebugOptionSet(STRING opt)
Test whether the specific debug option is set
- MACRO LogCurrentRequestToRPCLog(STRING source)
Log the current request to the RPC log
- OBJECTTYPE NotAShtmlContextException
Exception if a function is invoked which is only available when handling a dynamic page
- MACRO ProcessWHDebugVariablesUnchecked()
Explicitly accept wh-debug settings without checking. Should only be used for testing, as this can cause eg information leaks and captcha avoidance!
- MACRO Redirect(STRING url, INTEGER redirectcode)
Redirect the user to a page
- STRING FUNCTION RequireHTTPLogin(STRING realm, RECORD ARRAY accounts, RECORD options)
Require basic login/password verification for a page. Aborts on login failure. This allows you to implement trivial authentication for eg feeds and APIs but is not intended as a full-fledged login system for hundreds of users
- MACRO ResetWebResponse()
Reset the response
- MACRO SendWebFile(BLOB data)
Send a file to the web client
- MACRO SendWrappedWebFile(RECORD filerec, RECORD options)
Send a wrapped blob to the web client
- MACRO SetRequestUserName(STRING username)
Set the username to log for this request
- MACRO StoreWebSessionData(STRING sessid, STRING scope, RECORD sessdata)
Store data into a session
- MACRO UpdateWebCookie(STRING name, STRING value, RECORD options)
Set or update a cookie on the client
Image and adhoc cache
- RECORD FUNCTION GetCachedDataFromURL(STRING url)
Return the cached data from an URL
- STRING FUNCTION GetCachedFileLink(RECORD wrappedfile, RECORD options)
Get the URL to a cached file
- STRING FUNCTION GetCachedFSFileURL(STRING baseurl, INTEGER fsobjectid)
Get the URL to a file data download
- STRING FUNCTION GetCachedFSImageURL(STRING baseurl, INTEGER fsobjectid, RECORD scalemethod)
Get the URL to a (resized) image file
- STRING FUNCTION GetCachedFSSettingFileURL(STRING baseurl, INTEGER64 fssettingid, RECORD options)
Get the URL to an instance data file setting download
- STRING FUNCTION GetCachedFSSettingImageURL(STRING baseurl, INTEGER64 fssettingid, RECORD scalemethod)
Get the URL to a (resized) image in instance data
- STRING FUNCTION GetCachedImageLink(RECORD wrappedimage, RECORD processingmethod)
Get the URL to a cached preprocessed image file
- ASYNC FUNCTION GetPrecalculatedData(RECORD keydata, STRING func, RECORD options)
Get precalculated data, run in standalone job
- RECORD FUNCTION GetWrappedSourceFromURL(STRING url)
Extract the original image from an image cache URL
- OBJECTTYPE PrecalcDiscardQueryException
Throw this exception in a precalc calculation function to delete the query
- OBJECTTYPE UnifiedCacheHostBase
- RECORD FUNCTION WrapCachedImage(RECORD wrappedimage, RECORD processingmethod)
Get the URL and result of a cached preprocessed image file
Analytics, GEOIP
- STRING FUNCTION AnonymizeIPForAnalytics(STRING address)
Anonymize IP address for further analytics processing
- STRING FUNCTION GetClientAssumedIP()
Get the 'assumed' IP address for the client for eg. analytics and redirection. Allows clients to override the IP by setting wh-debug-overrideip (currently on development servers, in the future on all servers if we can verify you're a sysop)
- STRING FUNCTION GetClientGeoIPCountry()
Get the user's geoip country code. If the user has a private IP address, uses the preconfigured private-ip country
- STRING FUNCTION GetGeoIPCountryForIP(STRING ip_addr)
Quickly look up just the GeoIP country for an IP address
- RECORD FUNCTION GetGeoIPInfoForIP(STRING ip_addr)
Look up full geoIP info for an IP address