SimplePortal

Support => Turkish (Türkçe) => International Support => Ki?iselle?tirme => Topic started by: tc bolubeyi on July 20, 2011, 04:55:00 AM

Title: Avatarlı son iletiler bloğu
Post by: tc bolubeyi on July 20, 2011, 04:55:00 AM
Demo: http://www.spinabifidaturkey.com/smf/index.php
PHP Blok Kodları
Code: [Select]
$kacmesaj = 5;
$latestPostOptions = array('number_posts' => $kacmesaj,);
 global $smcFunc, $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl;
  $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions));
  $members = array();
  foreach ($context['latest_posts'] as $post)
   $members[] = $post['poster']['id'];
  $request = $smcFunc['db_query']('', '
   SELECT m.id_member, m.avatar, a.id_attach, a.attachment_type, a.filename
   FROM {db_prefix}members AS m
   LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
   
   WHERE m.id_member IN ({array_int:member_ids})',
   array(
    'member_ids' => $members,
   )
  );
  $avatar_profile = array();
  while ($row = $smcFunc['db_fetch_assoc']($request))
  {
   $avatar_profile[$row['id_member']] = array(
    'name' => $row['avatar'],
    'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" style="float: left;" width="30" />'),
    'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar_url'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
    'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
    'avatar' => array(
    'name' => $row_members['avatar'],
    'image' => $row_members['avatar'] == '' ? ($row_members['id_attach'] > 0 ? '<img src="' . (empty($row_members['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row_members['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row_members['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row_members['avatar'], 'http://') ? '<img src="' . $row_members['avatar'] . '" width="" height="" alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row_members['avatar']) . '" alt="" class="avatar" border="0" />'),
    'href' => $row_members['avatar'] == '' ? ($row_members['id_attach'] > 0 ? (empty($row_members['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row_members['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row_members['filename']) : '') : (stristr($row_members['avatar'], 'http://') ? $row_members['avatar'] : $modSettings['avatar_url'] . '/' . $row_members['avatar']),
    'url' => $row_members['avatar'] == '' ? '' : (stristr($row_members['avatar'], 'http://') ? $row_members['avatar'] : $modSettings['avatar_url'] . '/' . $row_members['avatar'])
   ),
  );
   
  }
  $smcFunc['db_free_result']($request);
 
  if (!empty($avatar_profile))
   foreach ($context['latest_posts'] as $k => $post)
    if (!empty($avatar_profile[$post['poster']['id']]))
     $context['latest_posts'][$k]['poster']['avatar'] = $avatar_profile[$post['poster']['id']];
     
global $context, $settings, $options, $txt, $scripturl, $modSettings;
  // 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 '
    <strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
    <p id="infocenter_onepost" class="middletext">
     ', $txt['recent_view'], ' "', $context['latest_post']['link'], '" ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
    </p>';
  }
    // Show lots of posts.
  elseif (!empty($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)
   echo '
   
    <div align="center">
   
    <table  border="0" bordercolor="#003c74" width="210" >
   
   
<tr style="align:left;background:#f5f5f5;">
  <td style=" border:solid 1px #003c74; height: 60px ; width: 60px ;"><img  class="profilresim" src="', !empty($post['poster']['avatar']['href']) ? $post['poster']['avatar']['href'] : $settings['images_url'] . '/noavatar.jpg', '" width="60" height="60"  /></a>
                              </td>
<td style=" border:1px solid #003c74; height: 60px ; width: 100% ;" ><strong>', $post['link'], '<br/></strong> <a style="color:red;">', $txt['by'], ' ', $post['poster']['link'], '</a><br/>', $post['time'], '</td>     
     </tr>   
    </table></div>
';
   
  }
Title: Re: Avatarlı son iletiler bloğu
Post by: gecitli on July 20, 2011, 06:13:02 AM
sagol bolubeyi güzel düsünce
SimplePortal 2.3.8 © 2008-2024, SimplePortal