24 Mar 2023 18:50 Yeni Konu Oluştur

Haberler:

Sitemiz Smf 2.1 ve Smf 2.0 sürümleri için Destek ve Tema paylaşım forumudur


bilgi merkezindeki son konulara avatar çekme

Başlatan snrj, 14 Şub 2022 00:09

« önceki - sonraki »

0 Üyeler ve 1 Ziyaretçi konuyu incelemekte.

*

  1. 3,263

  2. 596

  3. 1077

BoardIndex.template.php de bul
foreach ($context['latest_posts'] as $post)

echo '
<tr class="windowbg">
<td class="recentpost"><strong>', $post['link'], '</strong></td>
<td class="recentposter">', $post['poster']['link'], '</td>
<td class="recentboard">', $post['board']['link'], '</td>
<td class="recenttime">', $post['time'], '</td>
</tr>';

şu şekilde değiştirin
global $memberContext;
foreach ($context['latest_posts'] as $post)
{
$post['poster']['id']=!empty($post['poster']['id']==0)? 1 :$post['poster']['id'] ;
loadMemberData($post['poster']['id']);
loadMemberContext($post['poster']['id']);
echo '
<tr class="windowbg">';
if($memberContext[$post['poster']['id']]['avatar']['image'])
echo'<td class="avatar">', $memberContext[$post['poster']['id']]['avatar']['image'],'</td>';

echo'
<td class="recentpost"><strong>', $post['link'], '</strong></td>
<td class="recentposter">', $post['poster']['link'], '</td>
<td class="recentboard">', $post['board']['link'], '</td>
<td class="recenttime">', $post['time'], '</td>
</tr>';
}

css ile ufak tefek düzeltmeler yapabilirsiniz diğer konulardaki css kodlarına bakabilirsiniz

*

  1. 199

  2. 54

  3. 134
18 Şub 2022 20:48 #1 Son düzenlenme: 18 Şub 2022 20:51 gevv
Selam,

@snrj hocam  css ile avatarı ayarladım ama  bir türlü başlatan, kategori, tarih kısımlarını düzgün görünür hale getiremedim.

@gecitli  hocamın temsından  ayıklama yaptım  :)  biraz css düzenlemesi yaptım güzel  oldu

Kullanmak isteyen olursa  kod ve dosyaları ekliyorum.

Herkese teşekkürler.

Bu bölümdeki eklentileri göremezsiniz.


Alıntı yapılan: snrj - 13 Ekm 2017 15:28ilk olarak temanızın index.template.php de şu kısımı bulalım
 
// Set the following variable to true is this theme wants to display the avatar of the user that posted the last post on the board index.
 $settings['avatars_on_boardIndex'] = false;

burdaki false yi true çevirip kaydetelim



BoardIndex.template.php de bul;

/**
 * The recent posts section of the info center
 */
function template_ic_block_recent()
{
    global $context, $scripturl, $settings, $txt;

    // This is the "Recent Posts" bar.
    echo '
            <div class="sub_bar">
                <h4 class="subbg">
                    <a href="', $scripturl, '?action=recent"><span class="main_icons recent_posts"></span> ', $txt['recent_posts'], '</a>
                </h4>
            </div>
            <div id="recent_posts_content">';

    // Only show one post.
    if ($settings['number_recent_posts'] == 1)
    {
        // latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
        echo '
                <p id="infocenter_onepost" class="inline">
                    <a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a> ', sprintf($txt['is_recent_updated'], '&quot;' . $context['latest_post']['link'] . '&quot;'), ' (', $context['latest_post']['time'], ')<br>
                </p>';
    }
    // Show lots of posts.
    elseif (!empty($context['latest_posts']))
    {
        echo '
                <table id="ic_recentposts">
                    <tr class="windowbg">
                        <th class="recentpost">', $txt['message'], '</th>
                        <th class="recentposter">', $txt['author'], '</th>
                        <th class="recentboard">', $txt['board'], '</th>
                        <th class="recenttime">', $txt['date'], '</th>
                    </tr>';

        /* Each post in latest_posts has:
            board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
            subject, short_subject (shortened with...), time, link, and href. */
        foreach ($context['latest_posts'] as $post)
            echo '
                    <tr class="windowbg">
                        <td class="recentpost"><strong>', $post['link'], '</strong></td>
                        <td class="recentposter">', $post['poster']['link'], '</td>
                        <td class="recentboard">', $post['board']['link'], '</td>
                        <td class="recenttime">', $post['time'], '</td>
                    </tr>';
        echo '
                </table>';
    }
    echo '
            </div><!-- #recent_posts_content -->';
}


değiştir;

/**
 * The recent posts section of the info center
 */
function template_ic_block_recent()
{
    global $context, $scripturl, $settings, $txt;

    if (empty($context['latest_posts']) || count($context['latest_posts']) <= 1)
        return;

    // This is the "Recent Posts" bar.
    echo '
    <div class="recent-posts col-md-8">
            <div class="sub_bar">
                <h4 class="subbg">
                    <a href="', $scripturl, '?action=recent"><i class="icon fas fa-comments"></i>', $txt['recent_posts'], '</a>
                </h4>
            </div>
            <div id="recent_posts_content" class="topic-item-container card">';

    // Show lots of posts.
    if (!empty($context['latest_posts']))
    {
        loadMemberData(array_map(function($post) {
            return $post['poster']['id'];
        }, $context['latest_posts']));

        /* Each post in latest_posts has:
            board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
            subject, short_subject (shortened with...), time, link, and href. */
        foreach ($context['latest_posts'] as $post)
        {
            loadMemberContext($post['poster']['id']);

            if (!empty($post['poster']['id']))
                $avatar = $GLOBALS['memberContext'][$post['poster']['id']]['avatar'];
            else
                $avatar = array('image' => '<img class="avatar" src="'.$GLOBALS['modSettings']['avatar_url'] . '/default.png'.'" alt="avatar">');

            echo '
            <ul class="contacts-list">
            <!-- Chat Item Start -->
            <li class="contacts-item friends">
                            <div class="topic-item-poster-avatar">', $avatar['image'], '</div>
                            <div class="contacts-content">
                            <div class="contacts-info">
                                                <h6 class="chat-name text-truncate"><img class="rcnti" src="' . $settings['images_url'] . '/icons/user.png" alt="user" >', $post['poster']['link'], '</h6>
                                                <div class="chat-time"><img class="rcnti" src="' . $settings['images_url'] . '/icons/time.png" alt="time" >  ', $post['time'], '</div>
                                            </div>
                                            <div class="contacts-texts">
                                           
                                                <p class="text-truncate2"><img class="rcnti" src="' . $settings['images_url'] . '/icons/document.png" alt="topic" >', $post['link'], '</p>
                                               
                                                <div class="topic-item-board"><img class="rcnti" src="' . $settings['images_url'] . '/icons/folder.png" alt="board" > ', $post['board']['link'], '</div>
                                            </div>
                            </div>
                        </li>
                        <!-- Chat Item End -->
                 </ul>';
        }
    }
    echo '
            </div></div><!-- #recent_posts_content -->';
}

index.css  dosyasında en alta ekleyin;


.card {
    position: relative;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #ffffff;
    background-clip: border-box;
    border: 1px solid rgb(0 0 0 / 10%);
    border-radius: .25rem;
}
.contacts-list {
    padding: .2rem;
    list-style: none;
}
#recent_posts_content .friends {
    display: flex;
    height: 100%;
    flex-grow: 1;
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow-y: auto;
    overflow-x: hidden;
}
.contacts-list .contacts-content {
    padding-left: .875rem;
    transition: all .4s;
    overflow: hidden;
    max-width: 100%;
    flex: 1 1 auto;
}
.contacts-content .contacts-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .075rem;
}
.contacts-list .contacts-content .contacts-texts {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #adb5bd;
}
.contacts-list .contacts-item {
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 100%;
    padding: .3rem .5rem;
    border: 1px solid rgb(0 0 0 / 10%);
    border-radius: .25rem;
    transition: all .3s ease;
    color: inherit;
}

.topic-item-poster-avatar .avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    -o-object-fit: cover;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}


.topic-item-poster-avatar {
    height: 2.5rem;
    width: 2.5rem;
    min-width: 2.5rem;
    display: inline-block;
    position: relative;
    border-radius: 30%;
    box-shadow: 0 0 1px 1px rgba(0,0,0,.1);
}

.text-truncate2 {
    font-weight: bold;
}

.contacts-info h6 {
    font-weight: normal;
}

.rcnti {
    margin: 0px -2px -3px 0px;
}


@media (max-width: 550px)  {
   
    .rcnti {
        display: none;
    }

}

/*
@media (max-width: 550px)  {
   
    .topic-item-board {
        display: none;
    }

}
*/


ikon  dosyalarını Themes\default\images\icons  klasörüne atın



Not: Uzun bölüm isimleri kullanıyorsanız mobilde bölümleri gizleme görünüm açısından daha iyi oluyor.

Bu durumda css kodlarındaki  @media (max-width: 550px) üstünde ki /* ve altında ki */ kodlarını silin. Aşağıda ki bigi olmalı

@media (max-width: 550px)  {

.topic-item-board {
display: none;
}

}



Benzer Konular (5)


MENU ×