Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with code please


bill110

Recommended Posts

Posted

I am trying to place an image in the header depending upon which category is current. That part I have.

But I need a default image or no image at all to display if no category is current.

What happens now is I get an image placeholder if no category is current.

I've tried it two ways

	<?php 
$imagetop = DIR_WS_IMAGES . 'no_category.gif';
if (isset($current_category_id)){

  $imagetop = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
  $imagetop = tep_db_fetch_array($imagetop);
  $imagetop = $image1['categories_image'];
  } 
   ?>

<td><?php echo tep_image(DIR_WS_IMAGES . $imagetop); ?></td>

 

and this

	<?php 

if (isset($current_category_id)){

  $imagetop = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
  $imagetop = tep_db_fetch_array($imagetop);
  $imagetop = $image1['categories_image'];
  } 
   ?>

<td  background="../images/no_category.gif"><?php echo tep_image(DIR_WS_IMAGES . $imagetop); ?></td>

The second one will at least show the no-category.gif and the category image will be placed over it when one is current; however there is still a placeholder if no category is current.

I've tried a couple of "else" statements but either get syntax error on the same results.

 

any help is appreciated.

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Posted
I am trying to place an image in the header depending upon which category is current. That part I have.

But I need a default image or no image at all to display if no category is current.

What happens now is I get an image placeholder if no category is current.

I've tried it two ways

	<?php 
$imagetop = DIR_WS_IMAGES . 'no_category.gif';
if (isset($current_category_id)){

  $imagetop = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
  $imagetop = tep_db_fetch_array($imagetop);
  $imagetop = $imagetop['categories_image'];
  } 
   ?>

<td><?php echo tep_image(DIR_WS_IMAGES . $imagetop); ?></td>

 

and this

	<?php 

if (isset($current_category_id)){

  $imagetop = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
  $imagetop = tep_db_fetch_array($imagetop);
  $imagetop = $imagetop['categories_image'];
  } 
   ?>

<td  background="../images/no_category.gif"><?php echo tep_image(DIR_WS_IMAGES . $imagetop); ?></td>

The second one will at least show the no-category.gif and the category image will be placed over it when one is current; however there is still a placeholder if no category is current.

I've tried a couple of "else" statements but either get syntax error on the same results.

 

any help is appreciated.

Corrected code above(I had copied and pasted the wrong one)

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...