I see in PHPBB they use conditional statements inside their HTML, or XHTML; if you dont know what I mean here is a snippet:
<!-- IF MODERATORS -->
<p class="moderators"><!-- IF S_SINGLE_MODERATOR -->{L_MODERATOR}<!-- ELSE
-->{L_MODERATORS}<!-- ENDIF -->: {MODERATORS}</p>
<!-- ENDIF -->
<!-- IF U_MCP -->
<p class="linkmcp">[ <a href="{U_MCP}">{L_MCP}</a> ]</p>开发者_开发问答
<!-- ENDIF -->
Is there an explanation on how to implement this in my own site? It would be very useful and clean up a lot of code.
I would take a look at the PHPBB source code and find the files that parse these comments. There's probably a class for templates which you could reuse for your own projects.
If it helps, documentation about the syntax is available at:
http://area51.phpbb.com/docs/coding-guidelines.html#templates
PHP may work:
<?php if ($moderator) { ?>
<p class="moderators">
<?php } ?>
To have PHP code inside your template you need to use the special PHP "comment condition".
<!-- PHP -->
// your code goes here
<!-- ENDPHP -->
精彩评论