Вывод категорий в две колонки

Discussion in 'PHP' started by xspirit, 30 May 2007.

  1. xspirit

    xspirit New Member

    Joined:
    22 May 2007
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Пишу модуль файлового архива.
    PHP:
    function ShowCategory($parentid 0$sublevelmarker '')
     { 
       global 
    $tpl$cat_i_down$user_group$member_id$config;
         
    $allow_list explode (','$user_group[$member_id['user_group']]['allow_cats']);
      
       if(
    $parentid == 0) {
             
    $sublevelmarker .= '';
       }
       else {
           
    $sublevelmarker1 .= '';
       } 
      
         if (
    count($cat_i_down)) {
      
             foreach (
    $cat_i_down as $cats) {
                 if (
    $cats['parentid'] == $parentid$root_category[] = $cats['id'];
             }
      
             
    $count_category count($root_category);
             if (
    $count_category) {
                 
    $counter 0;
                 foreach (
    $root_category as $id) {
                     
    $counter++;
                     if (
    $allow_list[0] == "all" OR in_array($id$allow_list)) {
                         if (
    $parentid == 0) {
                             if (
    $config['allow_alt_url'] == "yes"){
                             
    $tpl->set('[full-link]',$sublevelmarker."<table border=3><a href=\"".$config['http_home_url']."files/cat{$cat_i_down[$id]['id']}.html\">");
                             }
                         else { 
                             
    $tpl->set('[full-link]',$sublevelmarker."<a href=\"".$config['http_home_url']."index.php?do=files&op=cat&id={$cat_i_down[$id]['id']}\">");
                         }
                         }
                         else {
                             if (
    $config['allow_alt_url'] == "yes")
                             
    $tpl->set('[full-link]',$sublevelmarker1."<a href=\"".$config['http_home_url']."files/cat{$cat_i_down[$id]['id']}.html\">");
                         else 
                             
    $tpl->set('[full-link]',$sublevelmarker1."<a href=\"".$config['http_home_url']."index.php?do=files&op=cat&id={$cat_i_down[$id]['id']}\">");
                         }
                             
                         if (
    $parentid == 0) {
                         
    $tpl->set('[/full-link]',"</a>");        
                         }
                         else {
                         
    $tpl->set('[/full-link]',"</a> &raquo;");
                         }
                         if (
    $parentid == 0) {            
                         
    $tpl->set('{title}'"<b>{$cat_i_down[$id]['name']}</b>");
                         
    $tpl->set('[number_files_cat]',"");
                         
    $tpl->set('{number_files_cat}',$cat_i_down[$id]['news_number']);
                         
    $tpl->set('[/number_files_cat]',"");
                         }
                         
    #&rarr;
                         
    else {
                             
    $tpl->set('{title}'"{$cat_i_down[$id]['name']}");
                         
    $tpl->set('{number_files_cat}',"");
                         
    $tpl->set_block("'\\[number_files_cat\\](.*?)\\[/number_files_cat\\]'si","");
                         }
      
                         
    $tpl->set_block("'\\[catheader\\].*?\\[/catheader\\]'si","");
                         
    $tpl->set_block("'\\[catline\\](.*?)\\[/catline\\]'si","\\1");
                         
    $tpl->set_block("'\\[catbreak\\].*?\\[/catbreak\\]'si","");
                         
    $tpl->set_block("'\\[catfooter\\].*?\\[/catfooter\\]'si","");
                         
    $tpl->compile('content');
                     }
                 
    ShowCategory($id$sublevelmarker);
                     if (
    $parentid == 0) {
                         
    $tpl->set_block("'\\[catheader\\].*?\\[/catheader\\]'si","");
                         
    $tpl->set_block("'\\[catline\\].*?\\[/catline\\]'si","");
                         
    $tpl->set_block("'\\[catfooter\\].*?\\[/catfooter\\]'si","");
                         
    $tpl->set_block("'\\[catbreak\\](.*?)\\[/catbreak\\]'si","\\1");
                         
    $tpl->compile('content');
                     }
                 }
             }
         }
     }

    Помогите сделать вывод категорий файлов с подкатегориями в два столбца.

    Теперешний вид :(

    [​IMG]


    и вид который нужно получить:

    [​IMG]

    ПОМОГИТЕ ПЛИЗЗЗ!!!!
     
    #1 xspirit, 30 May 2007
    Last edited: 30 May 2007
  2. GreenBear

    GreenBear наркоман с медалью

    Joined:
    7 May 2005
    Messages:
    2,548
    Likes Received:
    1,397
    Reputations:
    612
    http://www.w3.org/TR/html401/struct/tables.html
     
  3. xspirit

    xspirit New Member

    Joined:
    22 May 2007
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Таблицы я знаю! Помогите подогнать их под РНР код!
     
  4. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    У тебя все есть...сложно на таблицы растолкать?
     
  5. xspirit

    xspirit New Member

    Joined:
    22 May 2007
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Да, я запутался!!! :'(