I am just going to drop in with a quick tip for today. A lot of the time you will find that you need to comment out large blocks of code – these may include both PHP code and standard HTML code – and you may find your self manually going through every line wrapping HTML code in HTML comments (<!– –>) and commenting each PHP line with PHP comments (//). Obviously, this is a tedious task – fortunately for you, there is an easy solution!
Dreamweaver Server Comment
In Dreamweaver CS4 onwards, you can use something called a “Server Comment”. Bear in mind that this way of commenting will only work within a php page (i.e. a page ending with .php). To access this, follow these steps:
- In Dreamweaver, highlight the code you wish to comment out.
- In the left hand toolbar, click the “Apply Comment” drop down.
- Select “Apply Server Comment” from the list.
This comment will literally add the following tags around your code:
<?php /* ?>Your Code Here<?php */ ?>
So, even if you do not have Dreamweaver you can still use these tags for commenting out your code.
N.B. Make sure you are not using these tags within an already open PHP tag, as it opens a new one and may cause errors.
Customise your Dreamweaver Keyboard Shortcuts
It is a great idea to add this commenting function to a keyboard shortcut. To do so, just follow these steps:
- Open Dreamweaver and click “Dreamweaver -> Keyboard Shortcuts” from the main menu (PC = Edit -> Keyboard Shortcuts).
- Click the “Duplicate Set” icon on the top right.
- Rename this set to anything you want, perhaps “Custom Shortcuts”.
- Under the “Commands:” drop down, select “Code Editing”.
- Scroll down to “Apply Server Comment” and select it.
- Under “Shortcuts:” click the plus sign, then press the keys you would like to use as a shortcut.
- Click “OK” and you are done!
Now you can just press those keys to apply comments around PHP and HTML whenever you need to, simple right?
I hope this helps some of you web designers out there, let me know what you think about it or any other shortcuts you guys use!


Thanks a lot for this! I’ve been wanting an easy way to comment out PHP and HTML snarls for a long time.
Absolutely love this site
Dave