Zurück   xt:Commerce Webshop Shop Support > xt:Commerce Shopsoftware Community Area > Template System

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (permalink)  
Alt 12.04.2005, 16:25
 
Registriert seit: 04.06.2004
Beiträge: 6
Daumen hoch

Hallo!

Ich besch?ftige mich gerade mit der xtc_show_category.inc.php Datei. Hier m?chte ich ein CSS-Men? integrieren.

Beispiel:
Code:
<ul>
 <li>Kategorie 1
  <ul>
   <li>Kategorie 1.1
    <ul>
     <li>Kategorie 1.1.1</li>
    </ul>
   </li>
  </ul>
 </li>
 <li>Kategorie 2
  <ul>
   <li>Kategorie 2.1</li>
  </ul>
 </li>
 <li>Kategorie 3 </li>
</ul>
Aussehen und Funktionali?t kommt durch CSS.

Da ich mich in PHP nicht sehr gut auskenne, wollte ich fragen ob es soetwas schon irgendwo gibt oder ob mir jemand dabei helfen k?nnte das umzusetzen.
Was ich bisher geschafft habe (ist syntaktisch beim HTML-Output nicht ganz korrekt):
Code:
<?php

   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 .= '<ul>';

  }
  if ($foo[$counter]['level']=='') {
  if (strlen($categories_string)=='0') {
  $categories_string .='<ul>';
  } else {
  $categories_string .='</ul><ul>';
  }

  $categories_string .= $img_1;
  $categories_string .= '<li><a href="';
  } else {
  $categories_string .= '<li><a href="';
  }
  if ($foo[$counter]['parent'] == 0) {
   $cPath_new = 'cPath=' . $counter;
  } else {
   $cPath_new = 'cPath=' . $foo[$counter]['path'];
  }

  if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') $cPath_new.='&category='.xtc_cleanName($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 ( ($id) && (in_array($counter, $id)) ) {
   $categories_string .= '';
  }

  if (xtc_has_category_subcategories($counter)) {
   $categories_string .= '';
  }
  if ($foo[$counter]['level']=='') {
  $categories_string .= '</a></li>';
  } else {
  $categories_string .= '</a></li></ul>';
  }

  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 .= '';

  if ($foo[$counter]['next_id']) {
    xtc_show_category($foo[$counter]['next_id']);
  } else {
    $categories_string .= '</ul>';
  }
 }

?>
Ich weiss auch ungef?hr wieso, nur kann man das mit diesem Skript so nicht hinbekommen, sondern man m?sste weitere Schleifen einbauen, oder?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 13.04.2005, 09:58
 
Registriert seit: 10.06.2004
Beiträge: 229
Standard

ich bin auch daran interessiert.... :bounce: :bounce: :bounce: ich habe an verschiedene stellen verschiedene zeichen gesetzt damit ich sehen k?nnte wie meine aenderungen auswirken. so war meine primitive art rauszubekommen.richtig gelungen hats mir auch nicht.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #3 (permalink)  
Alt 14.04.2005, 19:16
 
Registriert seit: 04.06.2004
Beiträge: 6
Rotes Gesicht

Die Idee mit den Zeichen habe ich auch verfolgt, habe daf?r die Zeilennummer im PHP-Code genommen, so konnte ich feststellen wann welche Zeile aufgerufen wird.
Jedoch habe ich festgestellt, dass das momentane Men? nicht flexibel genug ist um so ein CSS-Men? korrekt umzusetzen.
Solange keine L?sung sich finden l?sst, werde ich notgedrungen ein Table-Men? erstellen :cry:
Bin n?mlich gerade dabei das gesamte XHTML-Template in CSS umzusetzen und ein Table-Men? mittendrin macht sich nicht gerade professionell.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #4 (permalink)  
Alt 15.04.2005, 06:17
Benutzerbild von dukie6666
VEYTON Service Partner
 
Registriert seit: 26.01.2004
Ort: Nueva Colombia/Paraguay
Beiträge: 1.855
Standard

ich habe es bei mir damals so gel?st:

Code:
<?php
/* -----------------------------------------------------------------------------------------
  $Id: xtc_show_category.inc.php,v 1.1 2004/04/26 20:26:42 fanta2k Exp $

  XT-Commerce - community made shopping
  http://www.xt-commerce.com

  Copyright (c) 2003 XT-Commerce
  -----------------------------------------------------------------------------------------
  based on: 
  (c) 2000-2001 The Exchange Project (earlier name of osCommerce)
  (c) 2002-2003 osCommerce(categories.php,v 1.23 2002/11/12); www.oscommerce.com
  (c) 2003 nextcommerce (xtc_show_category.inc.php,v 1.4 2003/08/13); www.nextcommerce.org 

  Released under the GNU General Public License 
  ---------------------------------------------------------------------------------------*/

   function xtc_show_category($counter) {
  global $foo, $categories_string, $id;


  // image for first level
  $img_1='<img src="templates/'.CURRENT_TEMPLATE.'/img/icon_arrow.jpg" alt="" />';

  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 .='<ul id="navlist">';
  
}
  
  $categories_string .= '<il><b><a href="';
  } else {
  $categories_string .= '<il><a href="';
  }
  if ($foo[$counter]['parent'] == 0) {
   $cPath_new = 'cPath=' . $counter;
  } else {
   $cPath_new = 'cPath=' . $foo[$counter]['path'];
  }

  if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') $cPath_new.='&category='.xtc_cleanName($foo[$counter]['name']);
  $categories_string .= xtc_href_link(FILENAME_DEFAULT, $cPath_new);
  $categories_string .= '">';

  if ( ($id) && (in_array($counter, $id)) ) {
   $categories_string .= '<b>';
  }

  // display category name
  $categories_string .= $foo[$counter]['name'];

  if ( ($id) && (in_array($counter, $id)) ) {
   $categories_string .= '</b>';
  }

  if (xtc_has_category_subcategories($counter)) {
   $categories_string .= '';
  }
  if ($foo[$counter]['level']=='') {
  $categories_string .= '</a></b></il>';
  } else {
  $categories_string .= '</a></il>';
  }

  if (SHOW_COUNTS == 'true') {
   $products_in_category = xtc_count_products_in_category($counter);
   if ($products_in_category > 0) {
    $categories_string .= '(' . $products_in_category . ')';
   }
  }

 

  if ($foo[$counter]['next_id']) {
    xtc_show_category($foo[$counter]['next_id']);
  } else {
    $categories_string .= '</ul>';
  }
 }

?>
__________________
Grüße Oliver


Zertifizierter xt:Commerce VEYTON Reseller & Service Partner
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #5 (permalink)  
Alt 15.04.2005, 10:07
 
Registriert seit: 04.06.2004
Beiträge: 6
Rotes Gesicht

Hierbei kommt aber kein syntaktisch korrektes HTML heraus:

Code:
<ul><li>Kat 1</li><li>Kat 1.1</li><li>Kat. 2</li></ul>
Da m?ssten f?r die Unterkategorie weitere <ul> rein.

N?chstes Problem w?re zu pr?fen, wenn eine Unterkategorie auftaucht, die Eltern-kategorie nicht mit direkt zu schliessen, sondern erst am Ende der Kinderkategorie.

Beispiel 1 (richtig):
Code:
<ul>
 <li>Kategorie 1
  <ul>
   <li>Kategorie 1.1</li>
  </ul>
 </li>
 <li>Kategorie 2</li>
</ul>
und nicht wie im Beispiel 2 (falsch):
Code:
<ul>
 <li>Kategorie 1</li>
  <ul>
   <li>Kategorie 1.1</li>
  </ul>
 <li>Kategorie 2</li>
</ul>
In Beispiel 1 wird nicht hinter Kategorie 1 ein verwendet, sondern erst hinter[*]Kategorie 1.1[/list].
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #6 (permalink)  
Alt 20.12.2005, 07:17
 
Registriert seit: 25.10.2005
Beiträge: 15
Standard

hat jemand (jetzt) daf?r eine saubere l?sung?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #7 (permalink)  
Alt 06.06.2006, 02:04
Benutzerbild von grafix-house
xt:C Sponsor
 
Registriert seit: 10.09.2005
Beiträge: 19
Standard

Hat jemand eine HTML syntaktisch richtige L?sung f?r Listen im Kategoriemen??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #8 (permalink)  
Alt 06.06.2006, 02:22
Benutzerbild von grafix-house
xt:C Sponsor
 
Registriert seit: 10.09.2005
Beiträge: 19
Standard

Code:
<?php
/* -----------------------------------------------------------------------------------------
 $Id: xtc_show_category.inc.php 1262 2005-09-30 10:00:32Z mz $

 XT-Commerce - community made shopping
 http://www.xt-commerce.com

 Copyright (c) 2003 XT-Commerce
 -----------------------------------------------------------------------------------------
 based on:
 (c) 2000-2001 The Exchange Project (earlier name of osCommerce)
 (c) 2002-2003 osCommerce(categories.php,v 1.23 2002/11/12); www.oscommerce.com
 (c) 2003 nextcommerce (xtc_show_category.inc.php,v 1.4 2003/08/13); www.nextcommerce.org

 Released under the GNU General Public License
 
 list-style version by toro@toro-net.com
 
 ---------------------------------------------------------------------------------------*/

function xtc_show_category2($counter, $prev_counter) {
  global $foo, $categories_string, $id;


  if (strlen($categories_string)=='0') {
  $categories_string .='<ul class="cat_level_'.$foo[$counter]['level'].'"><li>';
  } else {
 if ($foo[$counter]['level'] > $foo[$prev_counter]['level']) {
  $categories_string .= '<ul class="cat_level_'.$foo[$counter]['level'].'"><li>';
 }
 elseif ($foo[$counter]['level'] == $foo[$prev_counter]['level']) {
  $categories_string .= '</li><li>';
 }
 elseif ($foo[$counter]['level'] < $foo[$prev_counter]['level']) {
  $curr_level = $foo[$prev_counter]['level']; 
  while ($foo[$counter]['level'] < $curr_level) {
  $categories_string .= '</li></ul>';
  $curr_level--;
  }
  $categories_string .= '</li><li>';
 }
  }

$categories_string .= "\n";


  $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 ( ($id) && (in_array($counter, $id)) ) {
  $categories_string .= '';
  }

  $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 . ')';
  }
  }

  if ($foo[$counter]['next_id']) {  
  xtc_show_category2($foo[$counter]['next_id'], $counter);
  } else {
 if ($foo[$counter]['level'] > 0 ) {
 $curr_level = $foo[$counter]['level']; 
 while ($curr_level > 0 ) {
  $categories_string .= '</li></ul>';
  $curr_level--;
 }
 }
    $categories_string .= '</li></ul>';
  }
}

function xtc_show_category($counter) {
	xtc_show_category2($counter, 0);
}

?>
Bei dieser L?sung kannst du die "xtc_show_category.inc.php" beliebig wechseln ohne dar?ber nachzudenken, an welchen stellen noch Anpassungen gemacht worden sind.

Gefunden unter:
Link zum Thread
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #9 (permalink)  
Alt 06.06.2006, 05:46
Benutzerbild von dukie6666
VEYTON Service Partner
 
Registriert seit: 26.01.2004
Ort: Nueva Colombia/Paraguay
Beiträge: 1.855
Standard

hier gibt es auch eine sch?ne l?sung:
http://www.xt-commerce.com/forums/index.ph...ndpost&p=158687
__________________
Grüße Oliver


Zertifizierter xt:Commerce VEYTON Reseller & Service Partner
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #10 (permalink)  
Alt 06.06.2006, 09:07
Benutzer
 
Registriert seit: 26.08.2005
Beiträge: 60
Standard

habt ihr irgendwo eine demo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
cssmen, xtcshowcategoryincphp

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus



Alle Zeitangaben in WEZ +1. Es ist jetzt 04:10 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand