Добрый вечер, возник еще один вопрос, у нас имеется блок TopForums - в нем мы выводим самые активные (популярные) разделы форума, так вот суть вопроса:
Как в выборке урезать длину форума, например, 80 символов + далее добавить <...>
Нашел файлик: applications_addon/other/uportal/modules_public/uportal
//Top Forums
if ($this->globals['block']['top_forums'] != 0)
{
$count = 0;
if ($this->globals['setting']['num_top_forums'])
$number_of_forums = $this->globals['setting']['num_top_forums'];
else
$number_of_forums = 5;
$this->DB->build( array(
'select' => 'id, name, name_seo, topics, posts as replies',
'from' => 'forums',
'where' => 'sub_can_post = 1',
'order' => "topics desc, posts desc"
));
$query = $this->DB->execute();
while( $fetch = $this->DB->fetch($query) )
{
if( $this->registry->permissions->check( 'read', $this->registry->getClass('class_forums')->forum_by_id[$fetch['id'] ] ) !== false )
{
$this->top_forums[] = $fetch;
$count++;
}
if($count == $number_of_forums)
break;
}
}
//End Top Forums
тут мы видим выборку ..но я затрудняюсь с правильностью запроса..
Так же возник вопрос касательно блока последние сообщения:
//Latest Posts
if (($this->globals['block']['latest_posts_big'] != 0) || ($this->globals['block']['latest_posts']) != 0)
{
if ($this->globals['setting']['num_latestposts'])
$number_of_posts1 = $this->globals['setting']['num_latestposts'];
else
$number_of_posts1 = 5;
if ($this->globals['setting']['num_latestposts_big'])
$number_of_posts2 = $this->globals['setting']['num_latestposts_big'];
else
$number_of_posts2 = 5;
if($number_of_posts1 > $number_of_posts2)
$maxcount = $number_of_posts1;
else
$maxcount = $number_of_posts2;
$count = 0;
$limit = $maxcount + 20;
$where = "t.approved = '1'";
if($this->memberData['is_mod'])
$where = "1=1";
$this->DB->build( array(
'select' => 't.tid, t.title, t.title_seo, t.state, t.poll_state, t.posts as replies, t.last_post, t.last_vote, t.start_date, t.views, t.starter_name as guest_starter_name, t.last_poster_name as guest_last_poster_name, t.seo_last_name as guest_seo_last_name, t.seo_first_name as guest_seo_first_name',
'from' => array( 'topics' => 't' ),
'where' => $where,
'order' => 't.last_post desc',
'limit' => array( $limit ),
'add_join' => array(
array( 'select' => 'm.member_id as id, m.members_display_name, m.members_seo_name as seo_members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=t.last_poster_id',
'type' => 'left'
),
array( 'select' => 's.member_id as starter_id, s.members_display_name as starter_name, s.members_seo_name as seo_starter_name',
'from' => array( 'members' => 's' ),
'where' => 's.member_id=t.starter_id',
'type' => 'left'
),
array( 'select' => 'f.name, f.name_seo, f.id as forum_id',
'from' => array( 'forums' => 'f' ),
'where' => 'f.id=t.forum_id',
'type' => 'left'
)
)
));
$query = $this->DB->execute();
while( $fetch = $this->DB->fetch($query) )
{
if( $this->registry->permissions->check( 'read', $this->registry->getClass('class_forums')->forum_by_id[$fetch['forum_id'] ] ) !== false )
{
$this->latest_posts[] = $fetch;
$count++;
}
if($count == $maxcount)
break;
}
}
//End Latest Posts
Не успел отредактировать напишу тут в блоке последние сообщения хотелось бы обрезать длину темы где написали это сообщение..