Reputation: 49
I have a some piece of code like this. How can I add comments? It has both HTML and PHP combined code.
<?php / echo zen_draw_form('currencies', zen_href_link(basename(ereg_replace('.php', '', $PHP_SELF)), '', $request_type, false), 'get'); ?>
<div>
<span class="label"><?php echo BOX_HEADING_CURRENCIES;?>: </span>
<?php
if (isset($currencies) && is_object($currencies)) {
reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
$currencies_array[] = array('id' => $key, 'text' => $value['title']);
}
$hidden_get_variables = '';
reset($_GET);
while (list($key, $value) = each($_GET)) {
if (($key != 'currency') &&
($key != zen_session_name()) &&
($key != 'x') &&
($key != 'y')) {
$hidden_get_variables .= zen_draw_hidden_field($key, $value);
}
}
}
?>
<?php echo zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'class="select" onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id()?>
</div>
</form> */
Upvotes: 2
Views: 1287
Reputation: 8268
You have to use different comment styles - one for PHP and one for HTML.
See the example below.
<html>
<head>
<!--
<body>
<?php
/* echo 'Hello, World!'; */
?>
</body>
</head> -->
</html>
Upvotes: 0
Reputation: 3505
<?php
// PHP comment for one line ?>
<?php
/* This is
a PHP comment for
block */
?>
For HTML:
<!-- Comment for HTML code
<a href="#">test></a> -->
Upvotes: 1
Reputation: 701
You can use comment's like this,
<!-- Comment for HTML code
<form>
<div>
<?php /* Comment for PHP code */ ?>
</div>
</form> -->
Upvotes: 0
Reputation: 1900
Just comment the PHP code inside the PHP tags like this:
<?php
// This is a PHP comment line
/*
This is
a PHP comment
block
*/
?>
It doesn't matter if you have everything commented out inside the php tags.
Upvotes: 0