Global Variables
Global Variables and Functions
During the ContentBox request, common variables and super-type methods are made available to all templates and views used in that request. When developing themes and modules for ContentBox, the following methods and variables are available for use in customization:
#cb#
#cb#
The cb
object contains a variety of common methods for retrieving ContentBox content and settings. Below are some common methods used to retrieve and create HTML content:
Content and Settings Retrieval Methods
Settings Retreival
cb.siteName()
: retrieves the configured name of Contentbox installationcb.siteTagline()
: retrieves the configured tagline for the ContentBox installationcb.siteDescription()
: retrieves the configured description for the Contentbox installationcb.siteKeywords()
: retrieves the configured global keywordscb.siteEmail()
: retrieves the default site emailcb.siteOutgoingEmail()
: retreives the configured email used in outbound deliveries
Theme Views
cb.quickView( viewTemplate )
: Renders a view partial located in the[theme home]/views
directory. A.cfm
file extension is not required.cb.mainView( args )
: Renders the main view for the handler action. A struct containing the args necessary for view rendering should be passed in. By default, this struct is available in your layout and is also namedargs
.
Entry Retrieval
cb.getCurrentEntries()
:cb.getCurrentEntriesCount()
:cb.getCurrentCategories()
:cb.getCurrentPage()
:cb.getCurrentComments()
: Returns the published comments for the current entrycb.getCurrentCommentsCount()
: Returns the count of published comments for the current entrycb.getCurrentRelatedContent()
: Returns an array of content related to the active post or entrycb.getCurrentCustomFields()
: Returns a structure of custom fields for the active post or entrycb.getCustomField( string fieldName, any defaultValue )
: Returns the value of a custom field for the active post or entry
Content Store Retrieval
cb.contentStore( string slug )
: retrieves the HTML output of a Content Store item by its slug
cb.contentStoreObject( string slug )
: retrieves the associated Content Store objectcb.widget( string widgetName, struct args )
: executes a named widget'srenderit
method and returns the HTML. A structure of arguments may be passed.cb.getWidget( string widgetName )
: retreives the associated [widget][2] objectcb.themeSetting( string settingName, any defaultValue )
: retrieves a theme setting by name. A default value may be specifiedcb.isCommentsEnabled()
: returns a true|false value of whether site comments are enabled and if the current entry accepts commentscb.quickSearchForm()
: returns the HTML of a standard ContentBox Search Form according to the SearchForm widgetcb.getSearchResults()
: returns an array of results for an active search
Link Building Methods
cb.linkAdmin()
: creates a link to the ContentBox admincb.linkAdminLogin()
: creates a link to the ContentBox administration login formcb.linkAdminLogout()
: creates a link to logout of ContentBox administrationcb.linkBlog()
: creates a link to the site's blogcb.linksSelf()
: creates a link to the current pagecb.linkPageRSS( any categoryFilter)
: creates a link to the RSS feed applicable to the active requestcb.linkSiteRSS( any categoryFilter )
: creates a link to the site's RSS feedcb.linkCategory( string categorySlug )
: creates a link to a specific category pagecb.quickCategoryLinks( string categorySlug )
: creates an HTML unordered list of category links
Path and URL Utility Methods
cb.themeRoot()
: returns the location of your currently defined theme in the application, great for assets, cfincludes, etccb.siteRoot()
: returns the site root location using your configured module's entry pointcb.siteBaseURL()
: returns the site's SES base URLcb.adminRoot()
: returns the root location of the admin using your configured module's entry pointwidgetRoot()
: returns the location of your widgets, great for assets and includes
Interception Points
A number of built-in interception points are avaialble within the ContentBox request, which may be run using the cb.event()
method. For examples of how these are used, see the default theme layout files. Examples include:
cb.event( "cbui_beforeHeadEnd" )
cb.event( "cbui_afterBodyStart" )
cb.event( "cbui_afterContent" )
cb.event( "cbui_beforeBodyEnd" )
Development and Debugging Helper Methods:
cb.themeName()
: returns the currently active theme namecb.layoutName()
: returns the currently active layout namecb.isPrintFormat()
: returns true if you are in printing or exporting format
UI Utility Functions
Easily Render Captcha Images - ContentBox supports native captcha support and now your themes can render out a nice captcha image by using the new ContentBox helper method:
cb.renderCaptcha()
method.
Last updated