Skip to content

Chain snippets hotspot

erinata edited this page May 4, 2012 · 10 revisions

Chain Snippets Hotspot is a type of dynamic hotspot. It allows a snippet to call another snippet.

The syntax is to use (cha) at the beginning of a hotspot. For example, if you want to call a snippet which has triggertext "abc", the Chain Snippet Hotspot should be $[![(cha)abc]!]

For example if you have 2 snippets.

Snippet Triggertext: item
Snippet Content:

<p>Title:  $[![title]!]</p>
<p>Author: $[![name]!]
<p>Summary: $[![]!] </p>

and

Snippet Triggertext: collection
Snippet Content:

<div>
<h1>$[![Collection Title]!]</h1>
$[![(cha)item]!]
$[![(cha)item]!]
$[![(cha)item]!]
</div>

When you trigger the second snippet (collection), it will call the first snippet (item) 3 times and you will get:

<div>
<h1>Collection Title</h1>
<p>Title:  $[![title]!]</p>
<p>Author: $[![name]!]
<p>Summary: $[![]!] </p>

<p>Title:  $[![title]!]</p>
<p>Author: $[![name]!]
<p>Summary: $[![]!] </p>

<p>Title:  $[![title]!]</p>
<p>Author: $[![name]!]
<p>Summary: $[![]!] </p>

</div>

And the caret will stay at the h1 tag. If you hit [tab] again, the caret will go to the first $[![title]!] hotspot.

You can use chain snippets as many times as you like and you can even call another snippet in a chained snippet call. Chain Snippet Hotspot is a good tool to reduce duplication.

There is a cap on the number of chains (and any other dynamic hotspot) that can be triggered in one snippet triggering. The default value is 100. It means that if you call chain snippet more then a 100 times Fingertext will terminate the snippet triggering. 100 Should be a lot more than enough in normal usage. The cap is usually reach when there is a loop in the snippet chain. (Say snippet A is calling snippet B and snippet B is calling snippet A)

Back to Main Page