john
john

Reputation: 25

PHPBB template comment conditional

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.

Upvotes: 1

Views: 1203

Answers (3)

Markus Zeller
Markus Zeller

Reputation: 9145

To have PHP code inside your template you need to use the special PHP "comment condition".

<!-- PHP -->
// your code goes here
<!-- ENDPHP -->

Upvotes: 0

Josh
Josh

Reputation: 11070

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

Upvotes: 1

shipshape
shipshape

Reputation: 1742

PHP may work:

<?php if ($moderator) { ?>
<p class="moderators">
<?php } ?>

Upvotes: 0

Related Questions