Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hello

I have install a contrib to have a horizontal menu (I do not find the name).

On the page of the site, if I have

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

the menu is posted badly without the tabs and images just the names with background.

 

If I put

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

all is good

 

Have you an idea of the problem?

 

Code of menu is

<?php
// # of tabs on first row
$top_row = 8;
// create a piramid
$piramid = false;
// put active tab on forst row
$always_front = true;

$tab_width = 85;
$height = 25; 
$width1 = 15; 
$width2 = 22; 
$width3 = 15;
$text_align = 'bottom';

$last_on = false;

// top category query
$categories_query = tep_db_query("select c.categories_id, 
                                        cd.categories_name 
                                 from " . TABLE_CATEGORIES . " c, 
                                      " . TABLE_CATEGORIES_DESCRIPTION . " cd 
                                 where c.parent_id = '0' and 
                                       c.categories_id = cd.categories_id and 
                                       cd.language_id='" . $languages_id ."' 
                                 order by sort_order, cd.categories_name");

// determine the base category id for highlighting
if (isset($_GET['cPath'])){
 $full_path = tep_get_path_bare($_GET['cPath']);
 $cPath = $full_path;
 if (!stristr($full_path,'_')) {
   $base = $full_path;
 } else {
   $base = substr($full_path, 0, strpos($full_path, '_'));
 }
} elseif (isset($_GET['products_id'])) {
    $base = tep_get_product_path($_GET['products_id']);
    if (!stristr($base,'_')) {
      $base = tep_get_path_bare($base);
    } else {
      $base = substr($base, 0, strpos($base, '_'));
    }
}


   echo '<table align="center" height="' . $height . '" valign="bottom"  border="0" cellspacing="0" cellpadding="0">
          <tr valign="bottom">
            <td>';

     // used for dropdown boxes elsewhere on the site
     $top_categories = array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT));

     // index array for tab position manipulation
     $cat_index = array(); $i=0;

   while ($categories = tep_db_fetch_array($categories_query))  {
     $foo[$categories['categories_id']] = array(
       'name' => $categories['categories_name'],
       'path' => $categories['categories_id']);
       $i++;
       $cat_index[$i] = $categories['categories_id'];

       // used for dropdown boxes elsewhere on the site
       $top_categories[] = array('id'   => $categories['categories_id'],
                                 'text' => $categories['categories_name']);
   }

     $index = 1;
     $num_cats = sizeof($cat_index);

   // switch tab positions for 1st row
   if ($always_front) {
     if (isset($base)) {
        for($i=1; $i<$num_cats; $i++) {
         if ($cat_index[$i] == $base) break;
       }
       $cat_pos = $i;
       $top_row_th = $num_cats - $top_row + 1;
       if ($cat_pos < $top_row_th) {
         $new_pos = $cat_pos + $top_row;
         while ($new_pos < $top_row_th) {
           $new_pos = $new_pos + $top_row;
         }
         $repl_cat = $cat_index[$new_pos];
         $cat_index[$cat_pos] = $repl_cat;
         $cat_index[$new_pos] = $base;
       }
     }
   }

// array of start tabs
$sstart = array();
// array of stop tabs
$sstop  = array();

$sstart[] = 1;
$sstop[] = $num_cats;
$num_rows = 0;
$x = $num_cats;
$row_count = $top_row;

// determine start and stop tab positions
while (($x > 1) && ($row_count >= 1)){
 $sstop[] = $x-($row_count);
 $sstart[] = $x-($row_count-1);
 $x = $x - $row_count;
 if ($piramid) {
   $row_count = $row_count - 1;
 }
 $num_rows++;
}

     while ($index <= $num_cats) {
        $counter = $cat_index[$index];
        $cPath_new = 'cPath=' . $counter;

        if (in_array($index,$sstart)) {
          $start = true;
        } else {
          $start = false;
        }
        if (in_array($index,$sstop)) {
          $stop = true;
        } else {
          $stop = false;
        }
        if ($cat_index[$index] == $base) {
          $onpage = true;
        } else {
          $onpage = false;
        } 

        if ($start) { 
          $categories_string .=  '<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="50%"></td>';
        }

      if ($onpage) {
          if ($start) {
            $categories_string .= '<td class="tlo" height="' . $height . 'px" width="' . $width1 . 'px" nowrap >';
          } else {
            $categories_string .= '<td class="tfo" height="' . $height . 'px" width="' . $width2 . 'px" nowrap >';
          }
      } else {
          if ($start) {
            $categories_string .= '<td class="tlf" height="' . $height . 'px" width="' . $width1 . 'px" nowrap >';
          } else {
            if ($last_on) {
              $categories_string .= '<td class="tof" height="' . $height . 'px" width="' . $width2 . 'px" nowrap >';
            } else {
              $categories_string .= '<td class="tff" height="' . $height . 'px" width="' . $width2 . 'px" nowrap >';
            }
          }
      }

      $categories_string .= '</td>';

      if ($onpage) {
          $mouse = '';
          $tabPopCont = '';
        $categories_string .= '<td class="tabsOn tmo" width="' . $tab_width . 'px" align="center" valign="' . $text_align . '" height="' . $height . 'px"  nowrap >';
        } else {
          $categories_string .= '<td class="tabsOff tmf" width="' . $tab_width . 'px" align="center" valign="' . $text_align . '" height="' . $height . 'px"  nowrap >';
      }      

      $categories_string .= '<a class="tabsOff" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $tabPopCont . $foo[$counter]['name'] . '</a></td>';

        if ($stop) {
          if ($onpage) {
          $categories_string .= '<td class="tro" height="' . $height . 'px" width="' . $width3 . 'px" nowrap >';
        } else {
            $categories_string .= '<td class="trf" height="' . $height . 'px" width="' . $width3 . 'px" nowrap >';
          }  
          $categories_string .= '</td>';
        }

        if ($stop) {
          $categories_string .= '<td width="50%"></td></tr></table>';
        }

      if ($onpage) {
          $last_on = true;
        } else {
          $last_on = false;
        }
        $index++;
     }

   print ($categories_string);
     echo '</td></tr></table>';
?>

excuse my bad english!

Thank's

francois

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...