Simpleportal otomatik slider 2

Başlatan snrj, 20 May 2014 01:05

« önceki - sonraki »

0 Üye ve 2 Ziyaretçi konuyu incelemekte.

snrj

20 May 2014 01:05 Son düzenlenme: 27 Ağu 2014 18:41 Smfci

simpleportal da yeni bir php block oluşturun
içine yapıştırın
Kod [Seç]
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;
$parameters = array(
  'board' => array(1,2,5),
  'limit' => '10',
  'length' => '400',
);
teknoromi($parameters);

function teknoromi($parameters)
{
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;
 $block_parameters = array(
 'board' => 'boards',
 'limit' => 'int',
 'start' => 'int',
 'length' => 'int',
 'avatar' => 'check',
 
 );

 if ($return_parameters)
 return $block_parameters;

 $board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null;
 $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 30;
 $start = !empty($parameters['start']) ? (int) $parameters['start'] : 0;
 $length = isset($parameters['length']) ? (int) $parameters['length'] : 500;
 $avatars = !empty($parameters['avatar']);
 

 $limit = max(0, $limit);
 $start = max(0, $start);

 loadLanguage('Stats');

 $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
 $icon_sources = array();
 foreach ($stable_icons as $icon)
 $icon_sources[$icon] = 'images_url';


 if (!$parameters['perms_override'])
 {
 $board_count = count($parameters['board']);
 
 $board_limit = 1;
 $where = 'FIND_IN_SET(-1, member_groups)';
 if ($board_count > 1)
 {
 $where = 'id_board IN ({array_int:board_list}) AND ' . $where;
 $board_limit = $board_count;
 }
 $request = $smcFunc['db_query']('', '
 SELECT id_board
 FROM {db_prefix}boards
 WHERE ' . $where . '
 LIMIT {int:limit}',
 array(
 'board_list' => $parameters['board'],
 'limit' => $board_limit,
 )
 );
 if ($smcFunc['db_num_rows']($request) == 0)
 {
 if ($output_method == 'echo')
 die($txt['ssi_no_guests']);
 else
 return array();
 }
 
 $allowed_boards = array();
 while($row = $smcFunc['db_fetch_row']($request))
 $allowed_boards[] = $row[0];
 $smcFunc['db_free_result']($request);
 
 if ($board_count > 0)
 $parameters['board'] = array_intersect($parameters['board'], $allowed_boards);
 else
 $parameters['board'] = $allowed_boards;

 if (count($parameters['board']) == 0)
 $parameters['board'] = array(0);
 }
// Find the post ids.
 $request = $smcFunc['db_query']('', '
 SELECT id_first_msg, icon
 FROM {db_prefix}topics AS t INNER JOIN {db_prefix}messages AS m ON (t.id_first_msg = m.id_msg)
 WHERE t.id_board IN ({array_int:board_list})' . ($modSettings['postmod_active'] ? '
 AND t.approved = {int:is_approved}' : '') . '
 ORDER BY id_first_msg DESC
 LIMIT ' . $start . ', ' . $limit,
 array(
 'board_list' => $parameters['board'],
 'is_approved' => 1,
 
 )
 );
 $posts = array();
 while ($row = $smcFunc['db_fetch_assoc']($request))
 $posts[] = $row['id_first_msg'];
 $smcFunc['db_free_result']($request);


 $request = $smcFunc['db_query']('', '
 SELECT
 m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
 t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar,
 a.id_attach, a.attachment_type, a.filename, t.num_views
 FROM {db_prefix}topics AS t
 INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
 LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
 LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
 WHERE t.id_first_msg IN ({array_int:post_list})
 ORDER BY t.id_first_msg DESC
 LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}',
 array(
 'post_list' => $posts,
 'start' => $start,
 'limit' => !empty($per_page) ? $per_page : $limit,
 )
 );
 $return = array();
 $colorids = array();
 while ($row = $smcFunc['db_fetch_assoc']($request))
 {
 $limited = false;
 if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
 {
 $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
 $limited = true;
 }
 elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
 {
 $row['body'] = $smcFunc['substr']($row['body'], 0, $length);
 $limited = true;
 }

 $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

 // Only place an ellipsis if the body has been shortened.
 if ($limited)
 $row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';

 if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
 {
 $avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
 $avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
 }
 else
 {
 $avatar_width = '';
 $avatar_height = '';
 }

 if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
 $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

 
 // If we want to limit the length of the post.
 if (!empty($length) && $smcFunc['strlen']($row['body']) > $length)
 {
 $row['body'] = $smcFunc['substr']($row['body'], 0, $length);
 $cutoff = false;
 $last_space = strrpos($row['body'], ' ');
 $last_open = strrpos($row['body'], '<');
 $last_close = strrpos($row['body'], '>');
 if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6)
 $cutoff = $last_open;
 elseif (empty($last_close) || $last_close < $last_open)
 $cutoff = $last_space;

 if ($cutoff !== false)
 $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
 $row['body'] .= '...';
 }

 $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

 if (!empty($recycle_board) && $row['id_board'] == $recycle_board)
 $row['icon'] = 'recycled';

 // Check that this message icon is there...
 if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
 $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
 // $row['body'] içerisinde <img> kodu ara
   $secimyap = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $row['body'], $sonuc);
   // src="" içindekini al.
 if(!empty($sonuc[0]) && !empty($sonuc[1]))
   $ilkresim = $sonuc [1] [0];
  else{ // Resim bulunmazsa default resim ekle
     $ilkresim = $settings['theme_url'] . '/images/resimyok.jpg';
   }
 censorText($row['subject']);
 censorText($row['body']);

 if ($modSettings['sp_resize_images'])
 $row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);

 if (!empty($row['id_member']))
 $colorids[$row['id_member']] = $row['id_member'];

 $return[] = array(
 'id' => $row['id_topic'],
 'message_id' => $row['id_msg'],
 'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
 'subject' => $row['subject'],
 'short_subject' => shorten_subject($row['subject'], 33),
 'resim' => $ilkresim,
 'time' => timeformat($row['poster_time']),
 'views' => $row['num_views'],
 'body' => $row['body'],
 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
 'link' => '<a class="yorum" href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['num_replies'] . ' ' . ($row['num_replies'] == 1 ? $txt['ssi_comment'] : $txt['ssi_comments']) . '</a>',
 'replies' => $row['num_replies'],
 'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
 'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
 'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
 'poster' => array(
 'id' => $row['id_member'],
 'name' => $row['poster_name'],
 'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
 'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']
 ),
 'locked' => !empty($row['locked']),
 'is_last' => false,
 'avatar' => 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" border="0" />'),
 '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'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
 'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
 ),
 );
 }
 $smcFunc['db_free_result']($request);


 $return[count($return) - 1]['is_last'] = true;

 if (!empty($colorids) &&($colorids) !== false)
 {
 foreach ($return as $k => $p)
 {
 if (!empty($color_profile[$p['poster']['id']]['link']))
 $return[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
 }
 }

       echo'<div id="ps_slider" class="ps_slider">
 <a class="prev disabled"></a>
 <a class="next disabled"></a>
 <div id="ps_albums">';
 foreach ($return as $news)
     {
  echo '<div class="ps_album" style="opacity:0;">
 <a href="', $news['href'], '"> <img src="', $news['resim'], '" alt="', $news['subject'], '" />
 <div class="ps_desc"><h2>', $news['short_subject'], '</h2>
 <span>', temizle($news['body']), '
 </span></div></a></div>';
     }
          echo' </div>
 </div>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 <script src="', $settings['default_theme_url'], '/scripts/teknoromimanset.js"></script>';
}

function temizle($haber) {
     $strs=explode('<',$haber);
     $res=$strs[0];
     for($i=1;$i<count($strs);$i++)
     {
         if(!strpos($strs[$i],'>'))
             $res = $res.'&lt;'.$strs[$i];
         else
             $res = $res.'<'.$strs[$i];
     }
     return strip_tags($res);  
 }
 
index.css en alta ekle
Kod [Seç]
.ps_overlay{
    z-index:90;
    background:#111;
    width:100%;
    height:100%;
    position:fixed;
    top:0px;
    left:0px;
    opacity:0.5;
    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80);
}
/* Image container style */
.ps_container{
 width:480px;
 height:350px;
 position:absolute;
 top:50%;
 margin-top:-175px;
 left:50%;
 margin-left:-240px;
 z-index:100;
}
.ps_container img{
 border:10px solid #fff;
 position:absolute;
 top:50%;
 left:50%;
 -moz-box-shadow:1px 1px 10px #000;
 -webkit-box-shadow:1px 1px 10px #000;
 box-shadow:1px 1px 10px #000;
}

/* Thumbnail slider style */
.ps_slider{
 width:845px;
 height:300px;
 position:relative;
 margin: 0px auto 50px;
}
.ps_slider a.next,
.ps_slider a.prev{
 position:absolute;
 background-color:#000;
    background-position:center center;
    background-repeat:no-repeat;
    border:1px solid #232323;
    width:20px;
    height:20px;
    top:50%;
    margin-top:-10px;
    opacity:0.6;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;
    border-radius:5px;
    cursor:pointer;
    outline:none;
}
.ps_slider a.prev:hover,
.ps_slider a.next:hover{
    border:1px solid #333;
    opacity:0.9;
}
.ps_slider a.disabled,
.ps_slider a.disabled:hover{
    opacity:0.4;
    border:1px solid #111;
    cursor:default;
}
.ps_slider a.prev{
    left:-30px;
    background-image:url(../images/prev.png);
}
.ps_slider a.next{
    right:-30px;
    background-image:url(../images/next.png);
}
.ps_slider .ps_album{
 width:140px;
 height:310px;
 padding:10px;
 background-color:#333;
 border:1px solid #444;
 position:absolute;
 top:0px;
 text-align:center;
 cursor:pointer;
 -moz-box-shadow:1px 1px 4px #000;
 -webkit-box-shadow:1px 1px 4px #000;
 box-shadow:1px 1px 4px #000;
 
}
.ps_slider .ps_album:hover{
 background-color:#383838;
}
.ps_slider .ps_album a:hover{
 color:#000;
}
.ps_slider .ps_album img{
 height:90px;width: 130px;
 border:1px solid #444;
 -moz-box-shadow:1px 1px 4px #000;
 -webkit-box-shadow:1px 1px 4px #000;
 box-shadow:1px 1px 4px #000;
}
.ps_slider .ps_album .ps_desc{
 display:block;
 color:#666;
 background:#111 url(../images/overlay.png) no-repeat bottom right;
 height:200px;
 margin-top:10px;
 text-align:left;
 line-height:20px;
 overflow:hidden;
 text-overflow:ellipsis;
 border:1px solid #393939;
 -moz-box-shadow:0px 0px 2px #000 inset;
 -webkit-box-shadow:0px 0px 2px #000 inset;
 box-shadow:0px 0px 2px #000 inset;
}
.ps_slider .ps_album:hover .ps_desc{
 background-image:none;
}
.ps_slider .ps_album .ps_desc span{
 display:block;
 margin:0px 10px 10px 10px;
 border-top:1px solid #333;
 padding-top:5px;
}
.ps_slider .ps_album .ps_desc h2{
 margin:10px 10px 0px 10px;
 text-align:left;
 padding-bottom:5px;
 font-weight:normal;
 color:#ddd;
 text-shadow:0px 0px 1px #fff;
 border-bottom:1px solid #000;
}

@media screen and (max-width: 2020px) {
.sp_block {
    overflow: hidden;
}
}
ekte verdiğim resimleri Temanızın images klasörüne
ekte verdiğim js dosyasını Themes/default/scripts klasörüne kopyalıyın
kodların içindeki şu kısımı 'board' => array(1,2,5), kendinize göre düzeltin

akorkut

Merhaba. Bu slideri çalıştıramadım . Tam 4 kere yazılanları yaptım sonuç değişmedi. :D

snrj

ekteki js dosyasını ve resimleri gerekli yerlere attınız mı

akorkut

Merhaba. Denilenleri harfiyen yaptım ama olmadı. Belki çakışan mod vardır diye yapmaktan vazgeçtim.
İlginiz için teşekkür ederim.