dspBody - Mura Docs v7.0

dspBody

A Mura Scope helper method to dynamically output the body/content of a content item. This function automatically checks the content type, and displays output accordingly (e.g., if a Mura "Folder" or "Calendar", will output the children). Additionally, Mura checks to see if the content is restricted/protected, and if so, checks to see if the current user is logged in. If not logged in, will display a login screen. If user is logged in and does not have the required permissions, Mura will display a message to the user in lieu of the content.

Function Syntax

m.dspBody(
body
, pageTitle
, crumbList
, crumbSeparator
, showMetaImage
, metaImageSizeArgs
, metaImageClass
, includeMetaHREF
)

Parameters

Parameter Type Req/Opt Default Description
body string Opt m.content('body')

This is the primary content/body of a content item. If you omit this parameter, Mura will automatically use the content/body of the current content item.

pageTitle string Opt empty string

If you wish to display a title above the body/content, you may optionally pass in a title. For example: m.content('title')

crumbList boolean Opt true

If true, will display breadcrumb links above the body/content. Valid options are:

  • true
  • false
crumbSeparater string Opt » 

If crumbList=true, the string passed in here will be used as a delimiter between the links.

showMetaImage boolean Opt true

If true, will display the content item's associated image. Valid options are:

  • true
  • false
metaImageSizeArgs struct Opt {size='medium'}

An object/struct (list of key-value pairs) to be passed to the m.content().getImageURL(args) function. Commonly used keys are:

  • size (string, req). Valid values are:
    • small
    • medium
    • large
    • custom
    • Or, any pre-defined image size
  • height (opt). If size='custom', pass in desired height in pixels.
  • width (opt). If size='custom', pass in desired width in pixels.
metaImageClass string Opt empty string

This is the class attribute of the <img> tag for the associated image.

includeMetaHREF boolean Opt true

If true, will wrap the content item's associated image with <a> tags and a link to the content item. Valid options are:

  • true
  • false

Usage

Use this function to output the main content/body of a content item.

Example

The following example outputs the content/body, without a page title or breadcrumbs, while outputting the associated image (if one exists) using the 'medium' image size.

<cfoutput>
<article>
#m.dspBody(
body=m.content('body')
, pageTitle=''
, crumbList=false
, showMetaImage=true
, metaImageSizeArgs={size='medium'}
)#
</article>
</cfoutput>