Показать сообщение отдельно

  #172  
Старый 18.08.2006, 10:42
maxssx
Новичок
Регистрация: 17.08.2006
Сообщений: 5
Провел на форуме:
10444

Репутация: 0
По умолчанию

Цитата:
Сообщение от censored!  
Есть. На ру-борде ответили =)
Да вобщем это я и допетрил. а как сделать так чтоб построение списка было в две колонки.

Цитата:
пока только вот это придумал, может кто подскажет как оптимизировать и как сделать так чтобы товары выстраивались не в одну колонку а в несколько
Добавил функцию похожую на newspokat в файл functions.php
function getProduktPoKat($param)
{
global $db,$THEME,$area;
$last_threads = array();
$tmpl = new Koobi("templates/");
$fids = str_replace(",", ' OR articlecat = ', $param['KatId']);
$sql = $db->Query("
SELECT
id,
articlecat,
artnumber,
price,
title,
descr_short,
descr,
icon
FROM " . PREFIX . "_shop_articles WHERE articlecat =".$fids." AND active = 1 order by id desc LIMIT " . $param['limit']);//catname = `".$fids."`

$i = 0;

while ($row = $sql->fetchrow()) {
$last_threads[$i]['title'] = $row->title;
$last_threads[$i]['price'] = $row->price;
$last_threads[$i]['descr_short'] = $row->descr_short;
$last_threads[$i]['descr'] = $row->descr;
$last_threads[$i]['links'] = "index.php?p=shop&show=showdetail&fid=".$row->artnumber."&categ=".$row->articlecat."";
$last_threads[$i]['icon'] = "uploads/shop/icons/".$row->icon."";
$i++;
}
$tmpl->assign('catid', $param['KatId']);
$tmpl->assign('zagolovok', $param['zag']);
$tmpl->assign('theme', $THEME);
$tmpl->assign('last_produkt_array', $last_threads);
$produktpokat = $tmpl->fetch("$THEME/shop/produktpokat.tpl");

return $produktpokat;
}
////////////////////////
В koobi.class.php

$this->register_function('produktpokat', 'getProduktPoKat');
///////////////////////
Файл produktpokat.tpl лежит в shop/
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="box_inner">
<tr>
<td colspan="2" class="title_big" styel="padding:2px"><a href="index.php?p=newsarchive&amp;categ={$catid}" title="Все тексты блока &quot;{$zagolovok}&quot;">{$zagolovok}</a></td>
</tr>
{foreach from=$last_produkt_array item=lastprodukt}
<tr>
<td class="{cycle name=lastthread values='lastthreads_first,lastthreads_second'}">

<div class="topnews"><strong>{$lastprodukt.title}</strong></div>
<div class="intro" align="justify">{$lastprodukt.descr_short|truncate :200}</div>
<div align="right"><img src="{$img_folder}/more.gif" alt="" hspace="5" border="0" class="absmiddle" /><a href="{$lastprodukt.links}">{$lang.readmore}</a></div></td>
<td>
<img border="0" src="{$lastprodukt.icon}" style="padding-right:5px" alt="" />

</td>
</tr>
{/foreach}
</table>
<br />
 
Ответить с цитированием