Skip to content
matubaum edited this page May 11, 2012 · 4 revisions

PHP Emitter

This is the default emitter. You use this emitter when you decide to use Php as a template engine. This emitter allows you to use raw php code inside your templates. See examples for nodes an attributes below.

Nodes

Nodes are HTML comments that look something like this: <!---NODE_NAME---> <!---/NODE_NAME---> or <!---NODE_NAME/--->

  • block
  • class
  • invisible
  • method
  • php
  • skip
  • themes

Node :: block

Creates a function using the the containing text.

Layout.html

<body>
  Lorem Ipsum

  <!---block: hello parameters: $name--->
      <div>
          <span> Hello <strong tplcontent:replace="<?php echo $name?>">Mr Simpson </strong></span>
      </div>    
  <!---/block--->

</body>

Output: With the output you can do this:

echo hello("Homer"); 
//returns <span> Hello <strong>Homer</strong></span>

Node :: class

Creates a methods using the method node containing text. Ignores whatever is not in a method node.

Layout.html

<body>
  <!---class: Layout --->

      <!---method: header--->
          <div class= "header">Lorem Ipsum</div>
      <!---/method--->       

           <a>This is completely ignored since it's not </a>

      <!---method: body--->
          <div class= "content">A lot of html</div>
      <!---/method--->
  <!---/class--->
Clone this wiki locally