Creating a Chunk

Chunks are created via the Elements option in the manager interface by going to Elements then clicking New Chunk (the first icon from the left).

New Chunk Icon

To create an example chunk, after clicking new Chunk, set the Chunk Name to ‘example’ and in the Chunk (HTML) field put:

<div class="vcard">
	<strong class="fn">[[+name]]</strong>
	<span class="title">[[+title]]</span> at <span class="org">ACME Co</span>
	<span class="adr">
		<span class="street-address">1 ACME Plaza</span>
		<span class="locality">Location 1</span>, <span class="region">WA</span>
		<span class="postal-code">6000</span>

Save the chunk and return to the dashboard then select Documents, choose one of the documents to add the chunk to, if you followed the Getting Started Guide then you should have a My Home Page document. Add the snippet to the content with:

[[$example &name=`John Doe` &title=`Lead Programmer`]]

Now when you access the document through the front end the chunk will be parsed and included within the generated page. In this case it outputs a vcard micro format for the person named John Doe whose title is Lead Programmer. By using placeholders within chunks it's possible to reuse chunks.

It's perfectly acceptable to nest chunks inside chunks and also to pass chunks as parameters to other chunks.

Overriding Existing Chunks

If you need to change the formatting provided by a built in chunk then you can simply create a new chunk with the same name as the one you want to replace. clearFusionCMS will use the chunks created under Elements before it uses the ones supplied within the core system or modules.