how to make limit showing
bekti Offline
Junior Member
**
Posts: 43
Joined: Mar 2012
Post: #1
how to make limit showing
hy please help me..

i want to make a limit to show buddy list in usercp

so in usercp will show like this

- you have 20 friend (this is all the buddy)
- show result 1-10 from 20
then the buddy avatars will show only 10 avatars

i have already make this one,but still showing all buddy avatars

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$query = $db->simple_select("users", "buddylist", "uid = '".intval($mybb->input['uid'])."'");
$forum = $db->fetch_array($query);
$count_friend = 0;
if($forum['buddylist'] != "")
    {
        $timecut = TIME_NOW - $mybb->settings['wolcutoff'];
        
        $query = $db->simple_select("users", "*", "uid IN ({$forum['buddylist']})", array('order_by' => 'lastactive'));

        while($friend = $db->fetch_array($query))
        {
            $friend_name = format_name($friend['username'], $friend['usergroup'], $friend['displaygroup']);
            $profile_link = build_profile_link($friend_name, $friend['uid'], '_blank', 'if(window.opener) { window.opener.location = this.href; return false; }');

            if($friend['avatar'])
            {
                $friend['avatar'] = htmlspecialchars_uni($friend['avatar']);
                if($friend['avatardimensions'])
                {
                    require_once MYBB_ROOT."inc/functions_image.php";
                    list($width, $height) = explode("|", $friend['avatardimensions']);
                    $scaled_dimensions = scale_image($width, $height, 44, 44);
                }
                else
                {
                    $scaled_dimensions = array(
                        "width" => 44,
                        "height" => 44
                    );
                }
            }
            else
            {
                $friend['avatar'] = $theme['imgdir'] . "/default_avatar.gif";
                $scaled_dimensions = array(
                    "width" => 44,
                    "height" => 44
                );
            }
            $margin_top = ceil((50-$scaled_dimensions['height'])/2);
            eval("\$friendlist .= \"".$templates->get("member_profile_custom_friend")."\";");
           ++$count_friend;
        }
    }
    else
    {
        $friendlist = 'Buddie list is empty';
    } 
$lang->count_buddies = $lang->sprintf($lang->count_buddies, $count_friend);



that code show me like this
- you have 20 friend (this is all the buddy)
- show result 1-20 from 20

here is the question, i want to make limit when it's show avatar friends to 10

just like this

Quote:- you have 20 friend (this is all the buddy)
- show result 1-10 from 20
(then the buddy avatars will show only 10 avatars)

sorry for my bad english
09-21-2012 07:42 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
how to make limit showing - bekti - 09-21-2012 07:42 PM
RE: how to make limit showing - bekti - 10-04-2012, 08:08 PM

 Standard Tools
Forum Jump: