Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I comment things out?


Dennis99

Recommended Posts

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 :-"

Link to comment
Share on other sites

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 :-"

 

 

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??

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...