CTSchmidt
CTSchmidt

Reputation: 1205

which syntax for commentating in code cakephp

Like in the Title: I am searching for comment techniques. The most popular techniques does not work. Like // or /* */.

EDIT 1
forget to say only in .ctp files

EDIT 2
example code:

<div class="users index">
    <h2>Users</h2>
    <table cellpadding="0" cellspacing="0">/*
    <tr>
//      <th>id</th>
        <th>name</th>
        <th>username</th>
        <th class="actions">Actions</th>
    </tr>*/
    </table>
</div>

they won't work. I see them inside my page elements.

Upvotes: 0

Views: 5140

Answers (1)

xlecoustillier
xlecoustillier

Reputation: 16361

In your example you're trying to comment out HTML code using PHP comments syntax.

HTML comments syntax is different from PHP's.

Try:

<!-- <th>id</th> -->

But as Mark stated below, this code will still be visible from the client.

To avoid that, try:

<?php if(false) { ?><th>id</th><?php } ?>

If you want to use PHP comments, do it inside PHP tags:

<?php
    // echo "blah";
?>

But this is true in every PHP file, no matter its extension (.phpor .ctp).

Upvotes: 4

Related Questions