eXtension Templates for PHP (XTP for short)
Actual implementation of component - HTML
To better learn how to implement component (.phpx file) in XTP we should look this simple example:
<@
<option name="class" value="Navigation"/>
<option name="source" value="navigation.php"/>
<control tag="links" prefix="y" path="links.phpx"/>
@>
<div id="sidebar"><h2>Navigation</h2>
<ul>
<li><a href="/Codenizer">Codenizer</a></li>
<li><a href="/Memory">Memory Leak Detector</a></li>
<li><a href="/Support">Support Center</a></li>
${$this->Menu}
<li><a href="/Contact">Contact</a></li>
<li><a href="/About">About Softwarehood</a></li>
</ul>
<y:links/>
</div>
We can see that after prologue part (between <@ and @>) goes normal HTML with two exceptions:
- ${$this->Menu} -- everything between ${ and } is evaluated by template engine, so this will display value of property Menu of object (designer need not to be familiar with this)
- <y:links/> -- embedded component that
was announced in prologue part of template by
<control tag="links" prefix="y" path="links.phpx"/>
| « Previous Connecting code and template | Next » Logic controlling component - PHP |
