PDA

Просмотр полной версии : Вывод категорий в две колонки


xspirit
30.05.2007, 10:01
Пишу модуль файлового архива.

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('',"");
$tpl->set('{number_files_cat}',$cat_i_down[$id]['news_number']);
$tpl->set('',"");
}
#&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');
}
}
}
}
}



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

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

http://xrout.info/now.GIF


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

http://xrout.info/nado.GIF

ПОМОГИТЕ ПЛИЗЗЗ!!!!

GreenBear
30.05.2007, 10:16
http://www.w3.org/TR/html401/struct/tables.html

xspirit
30.05.2007, 10:39
Таблицы я знаю! Помогите подогнать их под РНР код!

Isis
30.05.2007, 11:21
У тебя все есть...сложно на таблицы растолкать?

xspirit
30.05.2007, 11:25
Да, я запутался!!! :'(