ModularMerchant
Knowledge Base
Shopping Cart Software Online Manual
Using comments in Custom QuickCode Tags
Using "Add to Cart" links on your website. Using the Custom Webpage Editor to add links to your Storefront
Location Home > Shopping Cart Software Components > Administration Area > Design > FAQs & Tutorials

Using comments in Custom QuickCode Tags

Comments are statements within code (webpage HTML, PHP code, JavaScript, etc.) that are not executed or displayed.  They are very useful when creating webpages, so here's a short tutorial on what they are, how to use them, and how they affect QuickCode™ tags.
 
What is a Comment?

Comments are strings of text within code that are not meant to be executed or displayed when a web page is rendered in a browser. They are prefixed or enclosed by certain characters so that the browser knows that it should ignore them, and the characters that are used depends on the programming or scripting language that you are using. 

In HTML, comments are enclosed in the tags "<!--" and "-->", while in PHP, a comment can be prefixed by "//" or enclosed by "/*" and "*/".  Here are some examples of comments.

html comments
<!-- This is a comment! -->
Lions and tigers and bears, oh my!
<!-- This is another comment! -->
Lions and tigers and bears!

php comments
<?php
// echo "This is a comment! "
echo ("Lions and tigers and bears, oh my!");
/* echo "This is another comment!" */
echo ("Lions and tigers and bears!");
?>

In both cases, the code will display only the lines about lions and tigers and bears.  Since text and commands within comments are not displayed or executed, none of the statements about comments will be seen by the user.

did you see that?
HTML comments will be present in a web page's source code.
PHP comments will not.

 
How Should I Use Comments?

Comments are used primarily to document code; as the name implies, programmers use comments to leave comments about what the code is intended to do.  This makes it a lot easier for you to remember what the code does when you, or someone else, come back to it months or years later.  It's a good idea to be as explicit as possible in your descriptions, because it will save you time and hassle in the long run.

The second common use for comments is to deactivate code that you no longer need. Placing comment tags around blocks of code removes them from the execution of the page, but preserves it, in case you want re-insert it later.  You can also use comments temporarily, while troubleshooting a problem, to remove working code and isolate the code that is causing the problem.  Once the problem is fixed, you can remove the comment tags to reinstate all of the working code on the page.
 
Can I use comments to deactivate custom QuickCode Tags?

The short answer is yes!  Simply encapsulate the custom QuickCode Tag's contents within the appropriate comment tags to turn it off.

deactivating content within a custom quickcode tag
<?php
/*
This content is within a comment.
None of this code within the comment will be executed.
echo ("Lions and tigers and bears, oh my!");
echo ("Lions and tigers and bears!");
*/
?>



— Last Edited - 02/24/2012 4:15pm PST
Rank and add a comment to this article
Only logged in users may leave comments and rank articles. Log in to have your say!
  Knowledge Base Home

  QuickCode™ Tag Glossary

  Modular Merchant.com Homepage

Not Logged in.
Either Log in or create a User Account.

Other articles in this category...

Add "Search by Price" links to the storefront

Add a "Terms of Service" agreement to a store page

Add a favicon

Add images to an email template

Adding a Company Name field to the storefront

Can QuickCode Tags Be Used in PHP Statements?

Can QuickCode Tags be used on non-store webpages?

Common customizations for the Order Receipt email

Copy a template package

Create a custom version of any QuickCode Tag

Create reusable headers/footer with Custom QuickCode Tags

Creating a Customer Registration Form

Creating templates with content viewable only by specific Customer Groups

Customize the category template to display subcategories in a grid

Customize the navigation header of a responsive template

Customize the navigation header of a responsive template

Customize the tabbed content area of a responsive product template

Disabling featured product display

Display a message if a customer has already purchased a product

Display a slideshow on any store page

Display sale prices in red text

Have your store match a website that links to it

Introduction to editing responsive template packages

Link your company logo to a different website

List of available Templates for use in Template Packages

Playing Flash video instead of downloading it

Require service agreement when a specific product is purchased

The difference between templates and web pages

Troubleshooting Missing Images

Untranslated Red QuickCode Tags

Using "Add to Cart" links on your website.

Using comments in Custom QuickCode Tags

Using the Custom Webpage Editor to add links to your Storefront

Your storefront on smartphones & mobile devices

Creating Template Packages: Part 1 of 4

Creating Template Packages: Part 2 of 4

Creating Template Packages: Part 3 of 4

Creating Template Packages: Part 4 of 4