Post by jty » Tue Nov 04, 2008 11:13 am

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

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by Qphoria » Tue Nov 04, 2008 11:18 am

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.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by jty » Tue Nov 04, 2008 12:06 pm

That works. Thank-you again
You and Bruce run the best Help Desk on the web  :-*

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by bruce » Tue Nov 04, 2008 1:11 pm

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

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by jty » Tue Nov 04, 2008 1:59 pm

Oh goodie, I get 2 answers for the price of none  :D

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

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by fido-x » Tue Nov 04, 2008 4:37 pm

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.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by jty » Tue Nov 04, 2008 5:21 pm

fido-x wrote: Hope that helps.
Yes, that helps heaps. Much better than my hit and miss guesses  :o
And it goes to prove that Open Cart has the best 24 x 7 help desk community on the web  :D

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by Qphoria » Tue Nov 04, 2008 8:55 pm

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

-->

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by yl » Mon Dec 29, 2008 2:34 am

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


     
       
         
         
       
       
       
         
       
     
   
 
 

yl
New member

Posts

Joined
Tue Nov 25, 2008 6:46 am

Post by Qphoria » Mon Dec 29, 2008 2:44 am

just change:

to:

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by yl » Mon Dec 29, 2008 2:52 am

Thank you Q! Are you always around 24/7? ;D

yl
New member

Posts

Joined
Tue Nov 25, 2008 6:46 am

Post by Qphoria » Mon Dec 29, 2008 3:00 am

I never sleep

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 3 guests