Page 1 of 1
Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 11:13 am
by jty
Hello,
I have noticed that sometimes my comment out works and sometimes it doesn't
eg this (from my home.tpl) is not working in FF but working in IE
Code: Select all
<!-- <div class="heading"><?php echo $text_latest; ?></div>
<?php foreach ($products as $product) { ?>
<div class="products"><a href="<?php echo $product['href']; ?>">
<img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>"></a><br><b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br><?php echo $product['price']; ?></div>
<?php } ?> -->
In FF, it still gives me the latest products but with a -->
I'm sure it was OK last night. Maybe it only works at nights

Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 11:18 am
by Qphoria
yea i've seen this too.
Usually for a line like:
">blah
If you comment the html
">blah-->
sometimes the php part is still executed
so you need to comment that too:
">blah-->
But I never bothered to research the reason why it doesn't always need to be done.
Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 12:06 pm
by jty
That works. Thank-you again
You and Bruce run the best Help Desk on the web

Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 1:11 pm
by bruce
You are very kind...
Remember that the template is still effectively a php script.
This means that a block of template code commented as follows will stop html and php processing.
Code: Select all
<?php /* start of commented block ?>
<div class="heading"><?php echo $text_latest; ?></div>
<?php foreach ($products as $product) { ?>
<div class="products"><a href="<?php echo $product['href']; ?>">
<img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>"></a><br><b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br><?php echo $product['price']; ?></div>
<?php } ?>
<?php end of commented block */ ?>
Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 1:59 pm
by jty
Oh goodie, I get 2 answers for the price of none
While we're on the topic, I get confused with the different comment characters
When do I use:
1. /* */
2. //
3.
Are there anymore that I'm yet to discover
Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 4:37 pm
by fido-x
jty wrote:
When do I use:
1. /* */
2. //
3.
As I understand them-
1. This is a "block" comment of the form /* comment */, and is used in programming languages, scripts and css.
2. This is for commenting a single line of code in programming languages and scripts.
3. This is for placing comments in HTML code.
Hope that helps.
Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 5:21 pm
by jty
fido-x wrote:
Hope that helps.
Yes, that helps heaps. Much better than my hit and miss guesses

And it goes to prove that Open Cart has the best 24 x 7 help desk community on the web

Re: Why Doesn't my Comment Out always work
Posted: Tue Nov 04, 2008 8:55 pm
by Qphoria
it is also very important to know that html is stupid and doesn't allow nested comments.
so you can't do
this is some extra text
-->
Re: Why Doesn't my Comment Out always work
Posted: Mon Dec 29, 2008 2:34 am
by yl
I recap this thread.. I want to block the "Total Cart Weight: 0.00g" from showing on my product page. I've tried these three methods, no luck. ..catalog/template/default/content/cart.tpl
Re: Why Doesn't my Comment Out always work
Posted: Mon Dec 29, 2008 2:44 am
by Qphoria
just change:
to:
Re: Why Doesn't my Comment Out always work
Posted: Mon Dec 29, 2008 2:52 am
by yl
Thank you Q! Are you always around 24/7?

Re: Why Doesn't my Comment Out always work
Posted: Mon Dec 29, 2008 3:00 am
by Qphoria
I never sleep