Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-14-2009, 05:44 PM
ScriptMan's Avatar
Super Moderator
Latest Blog:
None

 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 2,756
iTrader: 3 / 100%
ScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest order
Using remarks - comments in PHP HTML Apache and Basic Files

I spent more than a few minutes searching the other day to determine how to remark a line in an Apache .htaccess file so I decided a post of how to remark things in various scripting solutions might be a nice thing to have posted in this section of the forums.

For those who might not understand the remarks function, it a method for posting comments that are not executed. They are ignored by the processing system or the web browser. They serve the purpose of leaving a trail while writing a script or web page so that you can modify it as you need to. They are also useful for marking the starting and ending point of a particular portion of a script.

In html code a line like this one is not displayed in the browser:
PHP Code:
<!-- Comments go here --> 
It is displayed in the source file and my understanding is that bots can read it. It is handy to use if you want to take a line or two out of the code and see the effect before you delete or modify it.

In PHP a line preceded by 2 forward slashes is ignored and not processed:
PHP Code:
// echo "some string here"; 
will result in that echo not being processed or displayed.

PHP also has another remark function where an entire segment of a script can be deactivated. It starts with /* and ends with */
PHP Code:
/*
this line of code and
this line of code
and this one also will be ignored
*/ 
This is really useful if you want to turn off a script routine while you test a few other things.

As mentioned above, I usually mark the start and stop point of a script fragment/routine using remarks.
PHP Code:
// mysql start
lines of code
// END mysql 
Apache .htaccess files use the # symbol as the remark designator.
PHP Code:
#  This line of code will not be read or executed by Apache 
Basic. Does anyone still write in basic?
Basic uses rem as the ignore designator.
PHP Code:
rem write anything you want and it will be ignored 
In most cases the vast majority of remarks will be removed from the production version of script or web page though there are times and reasons to leave some of them in place.
__________________
These forums are as good as the posts that you contribute to them.~~
ScriptMan
Webmaster Help Articles
Share |
Reply With Quote
  #2 (permalink)  
Old 11-15-2009, 02:52 AM
megamoose's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 06-04-06
Location: London
Posts: 521
iTrader: 2 / 100%
megamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to all
Send a message via ICQ to megamoose Send a message via MSN to megamoose Send a message via Yahoo to megamoose Send a message via Skype™ to megamoose
Should also note the # can be used in PHP too for remarking.
__________________
Microsoft Office doesn't correct Chuck Norris. Chuck Norris corrects Microsoft Office.
Share |
Reply With Quote
  #3 (permalink)  
Old 11-15-2009, 06:05 AM
ScriptMan's Avatar
Super Moderator
Latest Blog:
None

 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 2,756
iTrader: 3 / 100%
ScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest order
Thanks. I did not know that one.
__________________
These forums are as good as the posts that you contribute to them.~~
ScriptMan
Webmaster Help Articles
Share |
Reply With Quote
  #4 (permalink)  
Old 11-15-2009, 06:15 AM
Hades's Avatar
Senior Web Developer
Latest Blog:
None

 
Join Date: 01-23-07
Location: Argentina
Posts: 2,231
iTrader: 0 / 0%
Hades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest order
Quote:
Basic. Does anyone still write in basic?
Basic uses rem as the ignore designator.
Also Oracle uses rem:

Code:
rem this is a comment. -- and this one too. /* this is a multiline comment */
__________________
Cristian Espinoza ~ Sr. Web Developer
Currently available for Freelance Web Development

(+54 9) 1155 601 661
Skype: espinoza.cristian
Share |
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply

Tags
apache, comments, html, php, remarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic HTML and CSS help Squeenix Coding Forum 2 08-22-2009 06:43 PM
Basic HTML question AngelaDawn Web Design Lobby 12 03-22-2009 08:43 AM
Need All The Help I Can Get -- Just Know Very Basic HTML x360 Web Design Lobby 3 06-22-2007 07:30 AM
Cpanel and Basic Authentication with Apache. marie6 Coding Forum 14 05-11-2007 12:36 PM
Basic website for course - comments please Ricoool Web Design Lobby 6 09-28-2004 08:22 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:52 AM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.