Terminal Icon

Cut and Paste

» Stamp, alternative PHP Templates

Instead of using inline syntax, Stamp uses a paper model metaphor. Templates are treated as if they where card models; certain parts need to be cut out and glued elsewhere. A designer simply marks the HTML area that is cuttable for developers:

 
    
<!-- cut:pacman -->    
    <
img src="pacman.gif" />
    <!-- /
cut:pacman -->

    <
div class="maze">
        <!-- 
paste:maze -->
    </
div>

This template shows a cut-area and a paste area. All cuttable areas are automatically cut on initialization. The template also marks a paste area. This is where the developer can paste an HTML snippet. Here is how one can put pacman in the maze:

 
    $game 
= new Stamp$HTML );
    
$pacman $game->fetch('pacman');
    
$game->pasteInto('maze'$pacman);
    echo 
$game;    
    

To display the result, simply echo the $game variable. Like this? Next, learn to fill a slot -->

Manual Pages

  • Philosophy
  • Welcome
  • Basics
  • Download
  • Painter Plugins
  • Navigation
  •  



    copyright © 2011 Gabor de Mooij | Stamp PHP Template Library