MyXoops Forum

Forum - myXOOPS German Support

6 - 4 = ?  
Geben Sie das Ergebnis der Berechnung ein
Sie haben max. 10 Versuche.
 
* = Erforderlich

hilfe bei array filterung

Betreff: hilfe bei array filterung
von krobi am 13.02.2006 23:47:32

hallo leute

ich bräucht mal wieder eure hilfe

bin grad am umschreiben von einpaar grundsachen von pd-downloads - um vorallem die queries weiter in den keller zu schrauben und um einpaar bugs zu beheben.

nun brauch ich aber hilfe, es geht um die im index angezeigten kategorien inkl deren sub-kategorien usw.

um den bug zu beheben das die unter-unter kategorien usw nicht angezeigt werdne, habe ich mich entschlossen das ganze einwenig umzuschreiben um das problem wirklich für alle zeit zu lösen.

ich lese jetzt alle kategorien einmalig in einen schön großen array ein - spart schließlich viele queries. jetzt geht es darum die kategorien und vorallem die unterkategorien hier richtig rauszulesen und genau hier liegt mein problem.

die kategorien werden bereits richtig angezeigt und für die anzeige der unterkategorien und deren unterkategorien usw hab ich zwar einen idee im kopf aber ich weiß nicht wie ich sie umsetzen soll.

aber hier erst mal der code-teil der relevant für das ganze ist

for ($a 0$a sizeof($mydata['cid']); $a++)
{
  if (
$mydata['pid'][$a] == 0)
  {
   
$totaldownload PDd_getTotalItems($mydata['cid'][$a], 1);
    
$indicator PDd_isnewimage($totaldownload['published']);

   
$subcategories "";
    
$title $myts->htmlSpecialChars($mydata['title'][$a]);

   if (
$xoopsModuleConfig['allowrss'])
   
$title .= "</b>&nbsp;<a href='" XOOPS_URL "/modules/$mydirname/rss.php?cid=" $mydata['cid'][$a] . "'>(RSS)</a>";

    
$temppoint 0;
   
$tempcid = array();
   
$temptitle = array();
   
$mypid = array();
   for (
$b 0$b sizeof($mydata['pid']); $b++)
   {
     if (
$mydata['pid'][$b] == $mydata['cid'][$a])
     {
       if (
$temppoint 0)
       {
         for (
$c 0$c sizeof($mypid); $c++)
         {
           if (
$mypid[$c] == $mydata['pid'][$b])
           {
             
array_push($mypid$mydata['pid'][$b]);
             
$temppoint++;
           }
         }
       }
       
        else if (
$temppoint == )
        {
         
array_push($mypid$mydata['cid'][$b]);
         
array_push($tempcid$mydata['cid'][$b]);
         
array_push($temptitle$mydata['title'][$b]);
         
$temppoint++;
       }
       for (
$i $i sizeof($mypid); $i ++)
       {
         echo 
"cid = $tempcid[$i]: pid = $mypid[$i]: titel = $temptitle[$i]<br>";
        }
     }
   }

   if (
is_file(XOOPS_ROOT_PATH "/" $xoopsModuleConfig['catimage'] . "/" $myts->htmlSpecialChars($mydata['imgurl'][$a])) && !empty($mydata['imgurl'][$a]))
    {
     if (
$xoopsModuleConfig['usethumbs'] && function_exists('gd_info'))
      {
       
$imgurl down_createthumb($myts->htmlSpecialChars($mydata['imgurl'][$a]), $xoopsModuleConfig['catimage'],
        
"thumbs"$xoopsModuleConfig['shotwidth'], $xoopsModuleConfig['shotheight'],
        
$xoopsModuleConfig['imagequality'], $xoopsModuleConfig['updatethumbs'], $xoopsModuleConfig['keepaspect']);
      }
     else
      
$imgurl XOOPS_URL "/" $xoopsModuleConfig['catimage'] . "/" $myts->htmlSpecialChars($mydata['imgurl'][$a]);
    }
   else
    
$imgurl $indicator['image'];

    
$xoopsTpl->append('categories', array('image' => $imgurl'id' => $mydata['cid'][$a], 'title' => $title,
    
'subcategories' => $subcategories'totaldownloads' => "".$totaldownload['count']."",
   
'count' => $count'alttext' => $indicator['alttext']));
    
$count++;
 }
}


nun in meinem kopf schugt folgendes herum: das herausbekommen welche unterkategorien nun welche unterkategorien hat müsste man eigentlich nur eines machen - mit der vorherigen cid suchen ob die als pid auftaucht und das am besten irgendwie geschickt speichern sodass man sich spätere suchereien im original array erspart und um auch zu wissen wie "tief" diese kategorien nun ist.

ich hoffe mir kann da jemand von euch helfen

Aktuell aus dem Forum

Forum Thema Antworten Views Letzter Beitrag
Modulentwicklung New Xoops Xcreate Module 0 5329 26.11.2025 15:22
efkan Gehe zum letzten Beitrag
Modulentwicklung XOOPS Custom Field Module 1 1816 24.11.2025 11:21
Goffy Gehe zum letzten Beitrag