Templates can contain slots. A slot is marked by two # characters. Here is how a template designer can define a slot in a template file:
<!-- cut:pacman -->
<img src="#filename#.gif" />
<!-- /cut:pacman -->
Here, we want to be able to replace the filename in our template. This how you can replace the filename from within the code:
$game = new Stamp( $HTML );
$pacman = $game->fetch('pacman')->put('filename','animated_pacman');
$game->pasteInto('maze', $pacman);
echo $game;
Use the put() function to fill a slot with a certain value.
copyright © 2011 Gabor de Mooij | Stamp PHP Template Library