ERLEDIGT
NEIN
NEIN
ANTWORTEN
3
3
ZUGRIFFE
336
336
EMPFEHLEN
-
Hallo ihr,
und zwar suche ich schon lange nach einer Lösung wie ich mein Shop-Kategorien(xt-commerce) nicht als Liste untereinander, sondern nebeneinander hinbekomm?
Ich kenn mit php nicht gut aus und kann daher den Quellcode nicht deuten:
Kann mir jemand sagen wo und wie diese Funktion abgerufen wird?
Wäre euch sehr dankbar!
PHP-Code:function xtc_show_category($counter) {
global $foo, $categories_string, $id;
// image for first level
$img_1='';
for ($a=0; $a<$foo[$counter]['level']; $a++) {
if ($foo[$counter]['level']=='1') {
$categories_string .= "";
}
$categories_string .= " ";
}
if ($foo[$counter]['level']=='') {
if (strlen($categories_string)=='0') {
$categories_string .='<table style="color:#3fc ;background-color:#000000;padding: 15px 25px 15px; font-size:14px; "><tr><td>';
} else {
$categories_string .='</td></tr></table><table style="color:#3fc ;background-color:#000000;padding: 15px 20px 16px; font-size:14px;" ><tr><td>';
}
$categories_string .= $img_1;
$categories_string .= ' <a href="';
} else {
$categories_string .= '<a href="';
}
$cPath_new=xtc_category_link($counter,$foo[$counter]['name']);
$categories_string .= xtc_href_link(FILENAME_DEFAULT, $cPath_new);
$categories_string .= '">';
if ( ($id) && (in_array($counter, $id)) ) {
$categories_string .= '';
}
// display category name
$categories_string .= $foo[$counter]['name'];
if ($foo[$counter]['level']=='') {
$categories_string .= '</a></b> ';
} else {
$categories_string .= '</a> ';
}
if (SHOW_COUNTS == 'true') {
$products_in_category = xtc_count_products_in_category($counter);
if ($products_in_category > 0) {
$categories_string .= '(' . $products_in_category . ')';
}
}
$categories_string .= '<br />';
if ($foo[$counter]['next_id']) {
xtc_show_category($foo[$counter]['next_id']);
} else {
$categories_string .= '</td></tr></table>';
}
}
?>
wenn is dann is wenn nie is dann is trotzdem
-
Das hat mit PHP eigentlich recht wenig zu tun. Mehr mit html.
Du musst die Azsgabe nicht in Zeilen sondern in Spalten setzen---------------------------------------------------------------------------------------------------
item: Tutorial: [PHP][MySQL] Debug Queries
item: Schreibt mir keine PN mit Fragen die im Forum beantwortet werden können - ich mache kein persönliches coaching
item: Ich habe es mir aus gesundheitlichen Gründen abgewöhnt unformatierten Code zu lesen (Auch SQL-Statements kann man formatieren!)
item: Bitte zur besseren Lesbarkeit PHP-Code in [PHP]...[/PHP], SQL in [SQL]...[/SQL], Visual Basic in [VB]...[/VB] etc. schreiben
-
Und wie mach ich das?
wenn is dann is wenn nie is dann is trotzdem
-
Sorry das ich den code hier so einfach "reinschmeiße"
Kann es dem Code liegen?
Habe echt keine Ahnung von php!
PHP-Code:// reset var
$start = microtime();
$box_smarty = new smarty;
$box_content = '';
$box_smarty->assign('language', $_SESSION['language']);
// set cache ID
if (!CacheCheck()) {
$cache=false;
$box_smarty->caching = 0;
} else {
$cache=true;
$box_smarty->caching = 1;
$box_smarty->cache_lifetime = CACHE_LIFETIME;
$box_smarty->cache_modified_check = CACHE_CHECK;
$cache_id = $_SESSION['language'].$_SESSION['customers_status']['customers_status_id'].$cPath;
}
if(!$box_smarty->is_cached(CURRENT_TEMPLATE.'/boxes/box_categories.html', $cache_id) || !$cache){
$box_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');
// include needed functions
require_once (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/inc/xtc_show_category.inc.php');
require_once (DIR_FS_INC.'xtc_has_category_subcategories.inc.php');
require_once (DIR_FS_INC.'xtc_count_products_in_category.inc.php');
$categories_string = '';
if (GROUP_CHECK == 'true') {
$group_check = "and c.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";
}
$categories_query = "select c.categories_id,
cd.categories_name,
c.parent_id from ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd
where c.categories_status = '1'
and c.parent_id = '0'
".$group_check."
and c.categories_id = cd.categories_id
and cd.language_id='".(int) $_SESSION['languages_id']."'
order by sort_order, cd.categories_name";
$categories_query = xtDBquery($categories_query);
while ($categories = xtc_db_fetch_array($categories_query, true)) {
$foo[$categories['categories_id']] = array ('name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false);
if (isset ($prev_id)) {
$foo[$prev_id]['next_id'] = $categories['categories_id'];
}
$prev_id = $categories['categories_id'];
if (!isset ($first_element)) {
$first_element = $categories['categories_id'];
}
}
//------------------------
if ($cPath) {
$new_path = '';
$id = split('_', $cPath);
reset($id);
while (list ($key, $value) = each($id)) {
unset ($prev_id);
unset ($first_id);
$categories_query = "select c.categories_id, cd.categories_name, c.parent_id from ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd where c.categories_status = '1' and c.parent_id = '".$value."' ".$group_check." and c.categories_id = cd.categories_id and cd.language_id='".$_SESSION['languages_id']."' order by sort_order, cd.categories_name";
$categories_query = xtDBquery($categories_query);
$category_check = xtc_db_num_rows($categories_query, true);
if ($category_check > 0) {
$new_path .= $value;
while ($row = xtc_db_fetch_array($categories_query, true)) {
$foo[$row['categories_id']] = array ('name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key +1, 'path' => $new_path.'_'.$row['categories_id'], 'next_id' => false);
if (isset ($prev_id)) {
$foo[$prev_id]['next_id'] = $row['categories_id'];
}
$prev_id = $row['categories_id'];
if (!isset ($first_id)) {
$first_id = $row['categories_id'];
}
$last_id = $row['categories_id'];
}
$foo[$last_id]['next_id'] = $foo[$value]['next_id'];
$foo[$value]['next_id'] = $first_id;
$new_path .= '_';
} else {
break;
}
}
}
xtc_show_category($first_element);
$box_smarty->assign('BOX_CONTENT', $categories_string);
}
// set cache ID
if (!$cache) {
$box_categories = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_categories.html');
} else {
$box_categories = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_categories.html', $cache_id);
}
$smarty->assign('box_CATEGORIES', $box_categories);
?>
wenn is dann is wenn nie is dann is trotzdem
Ähnliche Themen
-
DIVs nebeneinander und untereinander wie collapsible tabelle
Von kharn im Forum CSSAntworten: 1Letzter Beitrag: 27.05.10, 15:44 -
Buttons untereinander - anstatt nebeneinander
Von mkoeni1 im Forum JavaAntworten: 4Letzter Beitrag: 09.11.05, 22:21 -
Zwei Ebenen sollen untereinander stehen, nicht nebeneinander
Von folio im Forum CSSAntworten: 2Letzter Beitrag: 12.10.05, 20:29 -
Ergebnisse nebeneinander statt untereinander
Von bunitz im Forum PHPAntworten: 2Letzter Beitrag: 22.07.05, 12:56 -
Menü nicht untereinander sondern nebeneinander...
Von DejanB im Forum Javascript & AjaxAntworten: 1Letzter Beitrag: 16.07.04, 16:37





Zitieren

Login






[PHP] [Codeschnipsel] ImageColor aus HTML-Farbcodierung erstellen