collapse collapse

* Archive Notice

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work. This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 183
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

* Sohbet Kutusu

Refresh History
  • Destek için kullanmayın!
  • akorkut: Ama desteklerinizi de bekliyoruz.
    November 18, 2016, 08:41:36 AM
  • akorkut: grafitus hocam, yaklaşık 10 yıl.. smf, sp,  sizin ve diğer paylaşımseverin çalışmalarınızl bize destek oldu. Herşey için çok teşekkür ederiz.
    November 18, 2016, 08:40:38 AM
  • grafitus: Merhabalar herkese. Uzun zaman oldu, hayatlar değişti. Vakit ayıramaz olduk. SMF ve SimplePortal'ın yeri farklı olsa da artık aktif olmadıkları aşikar. Belki bir gün yeniden forumlar doğar. :)) Sevgilerle.
    November 18, 2016, 08:26:32 AM
  • tc bolubeyi: gelen giden yok pek
    July 31, 2016, 02:52:53 PM
  • tekniker974: Neredeyse 1 sene olmuş
    May 12, 2016, 01:05:50 AM
  • tekniker974: Günaydın
    May 12, 2016, 01:05:19 AM
  • tc bolubeyi: merhaba dostlara
    August 28, 2015, 08:56:04 AM
  • mert1i: ker alaka
    August 03, 2015, 10:07:49 AM
  • sonkalem: sa
    July 14, 2015, 03:27:51 PM
  • tc bolubeyi: sağolun ben de iyi allaha şükür
    June 10, 2015, 05:52:54 PM
  • mkuru: Teşekkürler Hasan Bey. Sizi sormalı
    May 27, 2015, 02:53:43 AM
  • tc bolubeyi: selam dostlar nasılsınız
    May 23, 2015, 06:52:15 PM
  • streetfire: Ben seviyorum.
    May 01, 2015, 03:39:22 PM
  • streetfire: Valla bilmiyorum. Sitemde çok kullanıyorum.
    May 01, 2015, 03:39:14 PM
  • mkuru: Evet haklısın
    April 03, 2015, 08:23:32 AM
  • mert1i: portalın en çok istenen ama en aaz talep gören kısmı bu chat
    April 01, 2015, 07:35:31 AM
  • mert1i: Selamun aleyküm ahali..
    January 27, 2015, 05:20:06 AM
  • tekniker974: a.s.
    August 12, 2014, 03:22:53 PM
  • delirium: S.a
    August 02, 2014, 10:24:22 AM
  • tekniker974: :nervous-happy:kimse yok
    July 15, 2014, 01:19:26 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: otomatik slider  (Read 2429 times)

0 Members and 1 Guest are viewing this topic.

Offline xxman

  • Newbie
  • Posts: 2
  • SMF Version: 2.0.4
  • SP Version: 2.0
otomatik slider
« on: May 21, 2014, 05:31:16 PM »

simpleportal da yeni bir php block oluşturun
içine yapıştırın
Code: [Select]
global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile;
$parameters = array(
  'board' => array(1,2,5),
  'limit' => '4',
  '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'], '')) !== 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/boardnew.png';
   }
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 '<style type="text/css" >
#featured .ui-tabs-panel .info{
display:none;
}
</style> <center> <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/jquery-1.3.2.min.js" ></script>
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/jquery-ui-1.7.2.custom.min.js" ></script>
<script type="text/javascript">
$(document).ready(function(){
$("#featured").tabs({fx:[{opacity: "toggle", duration: \'slow\'}, {opacity: "toggle", duration: \'normal\'}],
show: function(event, ui){
$(\'#featured .ui-tabs-panel .info\').hide();
var infoheight=$(\'.info\', ui.panel).height();
$(\'.info\', ui.panel).css(\'height\', \'0px\').animate({ \'height\': infoheight }, 500);
}
}).tabs("rotate", 5000, true);
$(\'#featured\').hover(
function(){ $(\'#featured\').tabs(\'rotate\', 0, true); },
function(){ $(\'#featured\').tabs(\'rotate\', 5000, true); }
);
$(\'#featured .ui-tabs-panel a.hideshow\').click(function(){
if($(this).text()==\'Hide\'){
$(this).parent(\'.info\').animate({ \'height\': \'0px\' }, 500);
$(this).text(\'Show\');
}
else{
$(this).parent(\'.info\').animate({ \'height\': \'70px\' }, 500);
$(this).text(\'Hide\');
}
return false;
});
});
</script>
   <div id="featured" >
  <ul class="ui-tabs-nav"> ';
         foreach ($return as $news)
          {
  echo '      <li class="ui-tabs-nav-item" id="nav-fragment-', $news['id'], '"><a href="#fragment-', $news['id'], '"><img src="', $news['resim'], '" alt="', $news['subject'], '" class="smallimg"/><span>', $news['short_subject'], '</span></a></li> ';
  }       
  echo '  </ul>';
foreach ($return as $news)
     {
  echo '
  <div id="fragment-', $news['id'], '" class="ui-tabs-panel" style="">
<a  href="', $news['href'], '"><img src="', $news['resim'], '" alt="', $news['subject'], '" class="bigimg"/></a>
<div class="info" >
<a  href="', $news['href'], '">', $news['subject'], '</a>
<p>', temizle($news['body']), ' </p>
</div></div>';
     }
          echo'</div></center>

';
}

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
Code: [Select]
#featured{
 width:400px;
 padding-right:250px;
 position:relative;
 border:5px solid #ccc;
 height:250px; overflow:hidden;
 background:#fff;
}
#featured ul.ui-tabs-nav{
 position:absolute;
 top:0; left:400px;
 list-style:none;
 padding:0; margin:0;
 width:250px; height:250px;
 overflow:auto;
 overflow-x:hidden;
}
#featured ul.ui-tabs-nav li{
 padding:1px 0; padding-left:13px; 
 font-size:12px;
 color:#666;
}
#featured ul.ui-tabs-nav li img{
 float:left; margin:2px 5px;
 background:#fff;
 padding:2px;
 border:1px solid #eee;
}
#featured ul.ui-tabs-nav li span{
 font-size:11px; font-family:Verdana;
 line-height:18px;
}
#featured li.ui-tabs-nav-item a{
 display:block;
 height:60px; text-decoration:none;
 color:#333;  background:#fff;
 line-height:20px; outline:none;
}
#featured li.ui-tabs-nav-item a:hover{
 background:#f2f2f2;
}
#featured li.ui-tabs-selected, #featured li.ui-tabs-active{
 background:url(../images/selected-item.gif) top left no-repeat; 
}
#featured ul.ui-tabs-nav li.ui-tabs-selected a, #featured ul.ui-tabs-nav li.ui-tabs-active a{
 background:#ccc;
}
#featured .ui-tabs-panel{
 width:400px; height:250px;
 background:#999; position:relative;
}
#featured .ui-tabs-panel .info{
 position:absolute;
 bottom:0; left:0;
 height:70px;
 background: url(../images/transparent-bg.png);
}


#featured .info p{
 margin:0 5px;
 font-family:Verdana; font-size:11px;
 line-height:15px; color:#fff;
}
#featured .info a{
 font-size:1.2em; font-family:Georgia, serif;
 color:wheat; padding:5px; margin:0; font-weight:normal;
 overflow:hidden;
}
#featured .info a:hover{
 text-decoration:underline;
}
#featured .ui-tabs-hide{
 display:none;
}
.smallimg{width:60px;height: 50px;}
.bigimg{width:400px;height: 250px;}

ekte verdiğim js dosyalarını temanızın /scripts klasörüne
ekte verdiğim resim dosyalarınıda  kullandığınız temanın images klasörüne atınız
 kodların içindeki şu kısımı 'board' => array(1,2,5), kendinize göre düzeltin
http://smf.teknoromi.com/index.php?topic=61.0