Webmaster общности: Predpriemach.com | SearchEngines.bg

    Да добавим аватара на последният коментирал в дадена тема

    Здравейте драги почитатели на тунингуваните PHPBB Форуми Veryhappy Veryhappy

    Сега ще ви дам малък пример, как да си направите
    форума така, че да показва не само кой и кога е постнал
    последното мнение в дадена тема но и аватара му .
    Така по бързо ще се сещаме кой е Laughing

    #
    #-----[ ОТВОРИ ]------------------------------------------
    #
    index.php
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u.user_id
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u.user_avatar, u.user_avatar_type, u.user_allowavatar
    
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u.user_id
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u.user_avatar, u.user_avatar_type, u.user_allowavatar
    
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u.user_id
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u.user_avatar, u.user_avatar_type, u.user_allowavatar
    
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    if ( count($forum_moderators[$forum_id]) > 0 )
    
    #
    #-----[ ПРЕДИ ТОВА, ДОБАВИ ]------------------------------------------
    #
    $last_post_avatar = '';
    
    if ( $forum_data[$j]['user_avatar_type'] && $forum_data[$j]['user_allowavatar'] )
    {
    switch( $forum_data[$j]['user_avatar_type'] )
    {
    case USER_AVATAR_UPLOAD:
    $last_post_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $forum_data[$j]['user_avatar'] . '" alt="" width="40" border="0" />' : '';
    break;
    case USER_AVATAR_REMOTE:
    $last_post_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $forum_data[$j]['user_avatar'] . '" alt="" alt="" width="40" border="0" />' : '';
    break;
    case USER_AVATAR_GALLERY:
    $last_post_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $forum_data[$j]['user_avatar'] . '" alt="" alt="" width="40" border="0" />' : '';
    break;
    }
    }
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    'LAST_POST' => $last_post,
    #
    #-----[ СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    'LAST_POST_AVATAR' => $last_post_avatar,
    #
    #-----[ ОТВОРИ ]------------------------------------------
    #
    viewforum.php
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    $sql = "SELECT t.*, u.username, u.user_id
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u.user_id
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u.user_avatar, u.user_avatar_type, u.user_allowavatar
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u2.user_id as id2
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u2.user_avatar as avatar2, u2.user_avatar_type as avatartype2, u2.user_allowavatar as allowavatar2
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    $sql = "SELECT t.*, u.username, u.user_id
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u.user_id
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u.user_avatar, u.user_avatar_type, u.user_allowavatar
    #
    #-----[ В СЪЩИЯ РЕД НАМЕРИ ]------------------------------------------
    #
    u2.user_id as id2
    #
    #-----[ В СЪЩИЯ РЕД СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    , u2.user_avatar as avatar2, u2.user_avatar_type as avatartype2, u2.user_allowavatar as allowavatar2
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
    #
    #-----[ СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    $topic_author_avatar = '';
    if ( $topic_rowset[$i]['user_avatar_type'] && $topic_rowset[$i]['user_allowavatar'] )
    {
    switch( $topic_rowset[$i]['user_avatar_type'] )
    {
    case USER_AVATAR_UPLOAD:
    $topic_author_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $topic_rowset[$i]['user_avatar'] . '" width="40" alt="" border="0" />' : '';
    break;
    case USER_AVATAR_REMOTE:
    $topic_author_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $topic_rowset[$i]['user_avatar'] . '" width="40" alt="" border="0" />' : '';
    break;
    case USER_AVATAR_GALLERY:
    $topic_author_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $topic_rowset[$i]['user_avatar'] . '" width="40" alt="" border="0" />' : '';
    break;
    }
    }
    
    
    $last_post_author_avatar = '';
    if ( $topic_rowset[$i]['avatartype2'] && $topic_rowset[$i]['allowavatar2'] )
    {
    switch( $topic_rowset[$i]['avatartype2'] )
    {
    case USER_AVATAR_UPLOAD:
    $last_post_author_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $topic_rowset[$i]['avatar2'] . '" width="40" alt="" border="0" />' : '';
    break;
    case USER_AVATAR_REMOTE:
    $last_post_author_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $topic_rowset[$i]['avatar2'] . '" width="40" alt="" border="0" />' : '';
    break;
    case USER_AVATAR_GALLERY:
    $last_post_author_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $topic_rowset[$i]['avatar2'] . '" width="40" alt="" border="0" />' : '';
    break;
    }
    }
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    'LAST_POST_IMG' => $last_post_url,
    #
    #-----[ СЛЕД ТОВА, ДОБАВИ ]------------------------------------------
    #
    'TOPIC_AUTHOR_AVATAR' => $topic_author_avatar,
    'LAST_POST_AUTHOR_AVATAR' => $last_post_author_avatar,
    #
    #-----[ ОТВОРИ ]------------------------------------------
    #
    templates/subSilver/index_body.tpl
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
    #
    #-----[ ЗАМЕСТИ С ТОВА ]------------------------------------------
    #
    <td class="row2" align="center" valign="middle" height="50"><table width="100%" cellpadding="2" cellspacing="0" border="0">
    <tr><td width="40">{catrow.forumrow.LAST_POST_AVATAR}</td><td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
    </tr></table></td>
    #
    #-----[ ОТВОРИ ]------------------------------------------
    #
    templates/subSilver/viewforum_body.tpl
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    <td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
    #
    #-----[ ЗАМЕСТИ С ТОВА ]------------------------------------------
    #
    <td class="row3" align="center" valign="middle"><table width="100%" cellpadding="1" cellspacing="0" border="0">
    <tr><td width="40">{topicrow.TOPIC_AUTHOR_AVATAR}</td>
    <td width="100%" class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
    </tr></table></td>
    #
    #-----[ НАМЕРИ ]------------------------------------------
    #
    <td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
    #
    #-----[ ЗАМЕСТИ С ТОВА ]------------------------------------------
    #
    <td class="row3Right" align="center" valign="middle"><table width="100%" cellpadding="2" cellspacing="0" border="0">
    <tr><td width="40">{topicrow.LAST_POST_AUTHOR_AVATAR}</td>
    <td width="100%" class="row3" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
    </tr></table></td>
    #
    #-----[ SAVE & ЗАТВОРИ ВСИЧКИ ФАЙЛОВЕ]------------------------------------------
    #
    #

    Разбира се, може да решите къде искате и къде не искате
    да се появява аватара, съответно само там ще редактирате.
    Ако има някакви проблеми моля пишете във форума ни