Jump to content

help with an if statement, please


fubarur

Recommended Posts

Ok this one is driving me crazy...  :shrug:

 

I have product categories and I want a little snipet of html to be displayed if someone looks a one certain category

 

category is 79000

 

<?php
// Scratch & Dent
echo $product['sub_category_id'];
if ($product['sub_category_id'] == 79000);
?>

<tr><td colspan="2" class="font-smx"><?=display_cms_data(160)?></td><tr>


<?php
else:
?>

 

What happens is that no matter what category that is viewed this html gets displayed. I have added the echo line when I was having issues to make sure that I had it pulling from correct area.

 

When I view the 79000 category I see the correct echo number and get the html displayed, but when viewing another category (lets say 36800) echo line says 36800 and html is still displayed.

 

What am I doing wrong? Thanks in advance.

 

 

Link to comment
Share on other sites

Change it to

<?php
// Scratch & Dent
if ($product['sub_category_id'] == 79000) {
   echo '<tr><td colspan="2" class="font-smx">' . display_cms_data(160) . '</td><tr>';
}
?>

 

You don't need an "else" clause if there's nothing to do.

 

Ken

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.