Advertisement:

Author Topic: Modsuz Avatar Boardindex (anasyafa son iletiler)  (Read 25063 times)

Offline Snrj

  • Jr. Member
  • **
  • Posts: 318
  • Gender: Male
    • Snrj Forumları
Modsuz Avatar Boardindex (anasyafa son iletiler)
« on: January 28, 2017, 05:46:17 PM »
bu yöntemle extra mod ve sql sorgusu kullanmadan site anasayfasında son iletilerin yanına avatar çekmeyi gösterelim
örnek resim

temanızda veya default temanın boardindex.template.php de
bul
Code: [Select]
function template_main()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;
değiştir
Code: [Select]
function template_main()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings,$memberContext;
bul
Code: [Select]
<td class="lastpost">';

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
echo '
</td>
değiştir
Code: [Select]
<td class="lastpost">';

if (!empty($board['last_post']['id'])){
loadMemberData($board['last_post']['member']['id']);
loadMemberContext($board['last_post']['member']['id']);
if($memberContext[$board['last_post']['member']['id']]['avatar']['image'])
echo'', $memberContext[$board['last_post']['member']['id']]['avatar']['image'],'';
else
echo'<img class="avatar" src="'.$settings['images_url'].'/theme/default_avatar.png" alt="*" />';
echo '
<p> ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
<strong>', $txt['last_post'], '</strong> ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
}
echo '
</td>
temanızın index.css de en alta ekle
Code: [Select]
.lastpost .avatar{
float:left;
width:30px;
height:30px;
border-radius:50%;
border: 1px solid #ccc;
    overflow: hidden;
}

defaul avatar için temanızın images klasörüne default_avatar.png adında bir avatar ekleyin veya ektekini atabilirsiniz
emeğe saygı başka yerlerde paylaşırken kaynak gösterelim snrj http://smf.konusal.com