Google+

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Afisare avatare membri
#1
Va salut pe toti. Am o problema la care nu ii gasesc rezolvarea. Este vorba de codul de mai jos:

Code:
$list .= '<a class="dfv_hover" href="member.php?action=profile&uid='.$row['uid'].'" target="_blank"><img class="dfv_border" src="'.$avatar.'" width="'.$width.'" height="'.$height.'"><span>'.$row['username'].' ('.$date.')</span></a>&nbsp;';
        } else {
            $list .= '<a class="dfv_hover" href="member.php?action=profile&uid='.$row['uid'].'" target="_blank"><img class="dfv_border" src="images/default_avatar.gif" width="'.$width.'" height="'.$height.'"><span>'.$row['username'].' ('.$date.')</span></a>&nbsp;';
	}

Dupa cum se poate citi din bucatica de cod, acesta ar trebuie sa afiseze avatarele membrilor care au fost pe forum. Problema este ca afiseaza doar imaginea default desi si membri care intra au avatare. Unde este eroare? Multumesc

Pentru a mentine un forum unitar si pentru a utiliza informatia intr-un numar cat mai mic de subiecte, va rugam ca inainte de a deschide o Discutie Noua sa folositi functia Cautare (Search) !
Cititi periodic
Regulamentul
#2
Salut!
Petre nu ai pus tot codul. Mai era o linie deasupra, un if. Acea linie era cea mai importanta. Daca afiseaza avatarul default inseamna ca intra numai pe ramura de else, de aceea am nevoie de linia cu if.
Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert.
Novice users : people who are afraid that simply pressing a key might break their computer.
Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it.
Expert users : people who break other people`s computers.
#3
Ai dreptate Mihai.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// se parseaza randurile obtinute din baza de date
    while ($row = $db->fetch_array($query)) {
        $avatar = $row['avatar'];
        $date = date('g:ma', intval($row['lastvisit']));
        if (!empty($avatar) && ($img = @getimagesize($avatar))) {
            // daca are un avatar atasat
            $list .= '<a class="dfv_hover" href="member.php?action=profile&uid='.$row['uid'].'" target="_blank"><img class="dfv_border" src="'.$avatar.'" width="'.$width.'" height="'.$height.'"><span>'.$row['username'].' ('.$date.')</span></a>&nbsp;';
        } else {
            $list .= '<a class="dfv_hover" href="member.php?action=profile&uid='.$row['uid'].'" target="_blank"><img class="dfv_border" src="images/default_avatar.gif" width="'.$width.'" height="'.$height.'"><span>'.$row['username'].' ('.$date.')</span></a>&nbsp;';
	}
    }
    // se afiseaza pe ecran datele
    if (strpos($templates->get('index_whosonline'), 'colspan') === false) {
        // tema simpla
        $dailyforumvisits = "<tr><td class='tcat'><span class='smalltext'><strong>Last {$users} Users Online</strong></span></td></tr><tr><td class='trow1'><span class='smalltext'>{$list}</span></td></tr>";
    } else {
        // tema complexa
        $dailyforumvisits = "<tr><td class='tcat' colspan='2'><span class='smalltext'><strong>Last {$users} Users Online</strong></span></td></tr><tr><td class='trow1 smalltext' align='center'><img src='images/dailyforumvisits.png' alt='Daily Forum Visits' /></td><td class='trow1'><span class='smalltext'>{$list}</span></td></tr>";
    }
}
?>

Pentru a mentine un forum unitar si pentru a utiliza informatia intr-un numar cat mai mic de subiecte, va rugam ca inainte de a deschide o Discutie Noua sa folositi functia Cautare (Search) !
Cititi periodic
Regulamentul
#4
Inlocuieste :

Code:
if (!empty($avatar) && ($img = @getimagesize($avatar))) {

cu :

Code:
if (!empty($avatar)) {

Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert.
Novice users : people who are afraid that simply pressing a key might break their computer.
Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it.
Expert users : people who break other people`s computers.
#5
Multumesc Mihai, a mers. Voi inchide acest subiect Smile.
Pentru a mentine un forum unitar si pentru a utiliza informatia intr-un numar cat mai mic de subiecte, va rugam ca inainte de a deschide o Discutie Noua sa folositi functia Cautare (Search) !
Cititi periodic
Regulamentul


Forum Jump:


Users browsing this thread: 1 Guest(s)