A Stamp t.e. template may contain 3 types of markers.
Cut Point
A cut point maker marks a region in the template that will be cut out from the template and stored under the specified ID.
<div>
<!-- cut:diamond -->
<img src="diamond.gif" />
<!-- /cut:diamond -->
</div>
Here we mark an image of a diamond with a cut point marker. We pass the template to SE:
$se = new StampTE($templateHTML);
If we now echo $se we see:
<div></div>
To obtain the diamond image we use:
$diamond = $se->get('diamond');
echo $diamond;
result:
<img src="diamond.gif" />
Glue Point
A glue point is the opposite of a cut point. It marks a region where HTML parts can be pasted.
<div>
<!-- cut:diamond -->
<img src="diamond.gif" />
<!-- /cut:diamond -->
</div>
<div id="box">
<!-- paste:jewellery -->
</div>
To drag the diamond in the jewellery box we do:
$diamond = $se->get('diamond');
$se->glue('jewellery',$diamond);
echo $se;
output:
<div id="box">
<img src="diamond.gif" />
</div>
You can add a comma separated list of IDs to restrict the glue point to certain HTML snippets only:
<!-- paste:jewellery(diamond,gem)-->
Slot Marker
A slot marker can be used to inject strings in the template:
<!-- cut:diamond -->
<img src="#picture#" />
<!-- /cut:diamond -->
We can use the slot marker to inject a filename in this case:
$diamond->inject('picture','diamond.gif');
Result:
<img src="diamond.gif" />
SINCE 0.5.2: Note that the second argument of inject() gets escaped using htmlspecialchars with ENT_COMPAT option and UTF-8 encoding, this means that double quotes are escaped but single quotes will remain intact, make sure you use ONLY double quotes in your HTML attributes and SET THE ENCODING to UTF-8! Otherwise your site may be vulnerable to XSS attacks. (use third parameter TRUE to avoid this).