Jump to main content Jump to doc navigation

bdTargets is a simple snippet to output your target groups.

Snippet Properties

Property Name Description Default Value
limit Limit the amount of results. 0
offset Offset to start at. 0
sortby Field to sort on. Can be sortorder, id or name. sortorder
sortdir Direction to sort on. Either asc or desc. asc
rowSeparator String to use between rowTpl items. \n
tplOuter Chunkname to wrap the complete result set in.
Default:
<h2>Target Groups</h2>
<ul>
    [[+wrapper]]
</ul>

Placeholders to use:

  • wrapper tplRow - Chunk name to wrap individual target groups in. Default:
<li>[[+name]]</li>

Placeholders to use:

  • id
  • name
  • sortorder

Examples

Minimum call:

[[!bdTargets]]

Result (depending on your target group data):

<h2>Target Groups</h2>
<ul>
  <li>Under 5</li>
  <li>From 15 to 18</li>
  <li>From 10 to 15</li>
  <li>From 5 to 10</li>
</ul>

Display as Select box

Snippet call:

<label for="target">Target Group</label>
[[!bdTargets? &tplRow=`bdl.target.row` &tplOuter=`bdl.target.outer`]]

bdl.target.row:

<option value="[[+id]]">[[+name]]</option>

bdl.target.outer:

<select name="target">
  <option value="0">Choose a Target Group</option>
  [[+wrapper]]
</select>

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • Chris Fickling
  • CrewMark
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$301 per month—let's make that $500!

Learn more