Jump to main content Jump to doc navigation

The cmCamperDetails snippet can be used to provide a "Vehicle Details" page. The snippet itself will not actually return any information, but instead it will set a bunch of placeholders to use in your template. See the Placeholders page for information on placeholders

The cmCamperDetails snippet requires a "cid" url or post parameter being available, which is used to identify the vehicle to display. If it is not present it can either send the user to a certain resource, or the snippet will return an error message. As your template will look very empty without, I suggest setting up a "Camper does not exist"-kind of page. Also see the cid*Action properties.

Snippet properties

&property Description Default Value
cidEmptyAction 0 a valid resource ID. When not 0, this will 301 redirect the user to the resource ID you specified. This is triggered when there was no "cid" url/post parameter found.
cidInvalidAction 0 a valid resource ID. When not 0, this will 301 redirect the user to the resource ID you specified. This is triggered when the "cid" parameter found was not a valid camper object (not found).
hideInactive 0 1. When set to 1, this will look at the cidInactiveAction and either display an error message or redirect the user if the vehicle is in status 0 (unconfirmed) or 5 (inactive).
cidInactiveAction 0 a valid resource ID. When not 0, this will 301 redirect the user to the resource ID you specified. This is triggered when the camper was found, but it is not
includeBrand 1 0. Determines if the related brand object should be retrieved. Can save some processing time when not needed.
includeOwner 1 0. Determines if the related owner object should be retrieved. Can save some processing time when not needed.
includeImages 1 0. Determines if the related images should be retrieved. Can save some processing time when not needed.
includeOptions 1 0. Determines if the related options should be retrieved. Can save some processing time when not needed.
tplImageOuter Chunkname. Outer template to wrap the entire image result set, called for every vehicle item. cmDefaultTplImageOuter
tplImageItem Chunkname. Template for one image item. cmDefaultTplImageItem
tplOptionsOuter Chunkname. Outer template to wrap the entire options result set, called for every vehicle item. cmDefaultTplOptionsOuter
tplOptionsItem Chunkname. Template for one option item. cmDefaultTplOptionsItem
tplOwner Chunkname. Template to use for displaying owner information. cmDefaultTplOwner
locale Locale used for the money_format function which formats the price. it_IT

How to use this Snippet

This snippet sets placeholders which are prefixed with cm. and which placeholders are set depend on your include* sections.

Make sure the snippet is before using the actual placeholders, as they will not be set then. Both your snippet and the placeholders will need to be uncached as it depends on the request.

Here is an example of calling the snippet:

[[!cmCamperDetails? &tplImageItem=`cmDetailImage` &includeImages=`1` &includeOwner=`0`]]

where cmDetailImage has the following content, which is used for a slideshow script and uses the phpthumbof snippet:

<li>
  <h3>[[+brand]] [[+type]] </h3>
  <span>[[+image:phpthumbof=`w=620&h=360&far=c`]]</span>
  <img src="[[+image:phpthumbof=`w=45&h=33&zc=1`]]" alt="thumb" />
</li>

And in the template itself you simply use the placeholders like this:

<ul>
  <li><span>Brand</span>[[!+cm.brand:default=`&nbsp;`]]</li>
  <li><span>Type</span>[[!+cm.type:default=`&nbsp;`]]</li>
  <li><span>Price</span>&euro; [[!+cm.price:default=`&nbsp;`]]</li>
  <li><span>Car</span>[[!+cm.car:default=`&nbsp;`]]</li>
  <li><span>Engine</span>[[!+cm.engine:default=`&nbsp;`]]</li>
</ul>

The default output modifier can be used for default values (in this case a non breaking space as the template required that when there is no value).

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