Dennis99 Posted November 16, 2004 Posted November 16, 2004 In index.php, I see the following lines: <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> If I change it to <!-- right_navigation //--> <!-- <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> --> <!-- right_navigation_eof //--> Nothing happens, i.e. the comment markers have no effect. Also, what is //--> everywhere? Thanks :-"
ozcsys Posted November 16, 2004 Posted November 16, 2004 In index.php, I see the following lines: <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> If I change it to <!-- right_navigation //--> <!-- <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> --> <!-- right_navigation_eof //--> Nothing happens, i.e. the comment markers have no effect. Also, what is //--> everywhere? Thanks :-" <{POST_SNAPBACK}> If you want to comment out a line or two you use // this will now be ignored If you want to comment out a chunck of code you use this /* This will now be ignored and this too */ The Knowledge Base is a wonderful thing. Do you have a problem? Have you checked out Common Problems? There are many very useful osC Contributions Are you having trouble with a installed contribution? Have you checked out the support thread found Here BACKUP BACKUP BACKUP!!! You did backup, right??
Guest Posted November 16, 2004 Posted November 16, 2004 There are 3 ways to comment PHP code. First, my preference for one-liners: # The number hash is an old school C style comment. Old habits are hard to die...plus it's one character instead of two line the next example: // There is not difference in how these are interpreted by the parser...they are both commented out. As was pointed out, there is also an entire block comment which is: /* Bunch of stuff commented Could be multiple lines and usually is... Can be any number of lines... */ Hope that helps...
Guest Posted November 16, 2004 Posted November 16, 2004 Additionally, if you're commenting HTML code inside of a PHP statement, you may also need to use the classic HTML comments of <!-- --> like you tried in the first place. But, for PHP, you need the ones mentioned in previous posts. -jared
Dennis99 Posted November 16, 2004 Author Posted November 16, 2004 Thanks all. I actually think my comments are working, but why when I comment out: <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> in index.php does nothing seem to happen?
Spekkio Posted November 16, 2004 Posted November 16, 2004 Unless you don't have anything in your column_left.php, you should definitely notice a difference. I don't know how you are commenting out column_left.php, but an easy way to comment it out is: <?php //require(DIR_WS_INCLUDES . 'column_left.php'); ?> Just put the two forward slashes before the require, and that line will be commented out. Hope this helps, ~Nate B.
Dennis99 Posted November 16, 2004 Author Posted November 16, 2004 Hmm, that worked, but if I go like: <!-- <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> --> it doesn't work.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.