TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 30, 2024, 06:34:12 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,174
  • Total Topics: 21,220
  • Online today: 147
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 115
  • Total: 116
  • @rjen

Blok yazılımcıkları (Block Snippets)

Started by sarba126, March 29, 2006, 07:59:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

deniz

İçeriğinizin kopyalanmasına sağ tuş engeli koymak isterseniz aşağıdaki kodu index.template.php dosyasında

/* Internet Explorer 4/5 and Opera 6 ...

satırından öncesine kopyalayınız.

// Bu kod ziyaretcilerin sag tus kullanmasina engel olur
if ($context['user']['is_guest'])
{
    echo '

<script language="Javascript1.2">

// Set the message for the alert box
am = "Ýçeriði kopyalamaya çalýþmayýn. Lütfen buraya link veriniz.! Yukarýda adres barda görünen linki sayfanýza kopyalamanýz yeterli.";

// do not edit below this line
// ===========================
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;

</script>';
}
// sag tus engeli kodu burada bitti




Bu kod sadece ziyaretçiler için çalışacaktır.

ayrıntılı bilgi için: http://www.simplemachines.org/community/index.php?topic=134890


deniz

aşağıdaki kodu bir php bloğa kaydettiğinizde rastgele bir konunun ilk mesajı gelir:

global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context;
global $func;
$length= 300;

loadLanguage('Stats');

if ($length === null)
$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
else
$length = (int) $length;

// Make sure guests can see this board.
$request = db_query("
SELECT ID_BOARD
FROM {$db_prefix}boards
WHERE FIND_IN_SET(-1, memberGroups)
        ORDER BY rand()
LIMIT 1", __FILE__, __LINE__);

list ($board) = mysql_fetch_row($request);
mysql_free_result($request);

// Load the message icons - the usual suspects.
$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';

// Find the post ids.
$request = db_query("
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics
WHERE ID_BOARD = $board
ORDER BY rand()
LIMIT 1", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
$posts[] = $row['ID_FIRST_MSG'];
mysql_free_result($request);

// Find the posts.
$request = db_query("
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
LIMIT 1", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
{
// If we want to limit the length of the post.
if (!empty($length) && $func['strlen']($row['body']) > $length)
{
$row['body'] = $func['substr']($row['body'], 0, $length);
// The first space or line break. (<br />, etc.)
        $cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

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

$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

// Check that this message icon is there...
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';

censorText($row['subject']);
censorText($row['body']);

$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'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['numReplies'] . ' ' . ($row['numReplies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']) . '</a>',
'replies' => $row['numReplies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>',
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'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['posterName'] . '</a>' : $row['posterName']
),
'locked' => !empty($row['locked']),
);
}
mysql_free_result($request);

foreach ($return as $news)
{
echo '
<div>
<a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b>
<div class="smaller">', $news['time'], ' ', $txt[525], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';
}

deniz

#42
OTOMATÄ°K META TAG


arama motorlarında size büyükk avantaj sağlaycak bir çözüm buldum.

metatag keyword leriniz artık konu başlığına göre değişicek. böylece konuya özel keyword yaratılacak. doalyısıyla konularınızın google gibi arama motorlarında bulunma ve ön sıralara yükselme imkanı yaratılcak. nasıl mı ?

index.template.php dosyasına girip:

function template_main_above()
{
        global $context, $settings, $options, $scripturl, $txt, $modSettings;


altına bu kodu ekliyorsunuz:

$stop_words=  array(" ben "," sen "," hakkında "," bir "," nerede "," ki "," kim "," nerede "," ve "," com "," de "," en "," için "," tarafından "," nasıl "," ne "," içinde "," ile "," www ","!",".","?","=","-");
        $keywords_ = str_replace($stop_words," ",$context['page_title']);
        $keywords_ =  preg_replace ( "/\s\s+/" , " " , $keywords_);
        $keywords_ = str_replace(" ",", ",trim($keywords_));


sonra aşağıdaki satırı
<meta name="keywords" content="....." />

(... olan yerlerde size özel keyworldler veya smf nin kendi klasik keywordleri yer alır)
bununla deÄŸiÅŸtiriyorsunuz:

<meta name="keywords" content="'.$keywords_.'" />


sonucu görmek için herhangi bir konuya girip sayfa kaynağına bakın.

alıntı

deniz

Aşağıdaki kodu php makaleye kaydedip sonrada bu makaleye link verdiğinizde sitenizdeki tüm konuların alfabetik fihristi yaratılır.

global $db_prefix, $user_info, $scripturl, $modSettings;

$page = $_GET['page'];
if (isset($_GET['letter']))
  $search = ' AND subject LIKE "'.$_GET['letter'].'%"';
else
  $search = ' AND subject LIKE "A%"';

$request = db_query("
        SELECT t.ID_TOPIC, posterTime, ID_MEMBER, subject, posterName, b.ID_BOARD, numReplies, numViews, memberGroups
        FROM {$db_prefix}messages AS mes, {$db_prefix}topics AS t, {$db_prefix}boards AS b
        WHERE ID_FIRST_MSG = ID_MSG
        AND b.ID_BOARD = t.ID_BOARD
        AND $user_info[query_see_board] $search
        ORDER BY subject", __FILE__, __LINE__);

$lastLetter = '';
echo '<table>';
echo '<tr><td colspan="5">';
for ($i = 65; $i < 91; ++$i)
  echo '<a href="' , $scripturl , '?page=' , $page , ';letter=' , chr($i) , '"><b>',  chr($i) , '</b></a> ';
echo '</td></tr>';

while ($row = mysql_fetch_assoc($request))
{
        $row['subject'] = html_entity_decode($row['subject'],ENT_QUOTES);
        if ($lastLetter <>  strtoupper($row['subject']{0}))
        {
          $lastLetter = strtoupper($row['subject']{0});
        echo '<tr><td colspan="5"> </td></tr>';
        echo '
        <tr><td><b>' , $lastLetter , '</b> ile baÅŸlayan konular</td>
                <td>BaÅŸlatan  </td>
                <td>Tarihi </td>
                <td align="center"> Yanıtlar </td>
                <td align="center"> Ä°zlenme </td></tr>
        <tr><td colspan="5"><hr /></td></tr>';
        }
        $startdate = $row['posterTime'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
        echo '<tr>
        <td> <a href="' , $scripturl , '?topic=' , $row['ID_TOPIC'] , '.0">' , $row['subject'] , ' </td>
        <td> <a href="' , $scripturl , '?action=profile;u=' , $row['ID_MEMBER'] , '">', $row['posterName'] , '</a> </td>
        <td> ', date('d.m.y',$startdate) , ' </td>
        <td align="center"> ' , $row['numReplies'] , ' </td>
        <td align="center"> ' , $row['numViews'] , ' </td></tr>';
}
echo '</table>';

mysql_free_result($request);


demo: http://sifirforum.com/index.php?page=128

deniz

Son haftada en çok mesaj gönderenler listesi:

aşağıdaki kodu php bloğa kaydedin:

global $db_prefix, $scripturl;

$starttime = time() - 604800; // 604800 sayisi saniye cinsinden bir haftalik suredir. Istediginiz zaman araligi icin degistirebilirsiniz.
$endtime = time ();  // Su an ki zamandir. arzu ederseniz yukardaki degeri ve bu degeri istenilen zaman aralginda da secebilirsiniz. ama tarihi unix formatina cevirmek sarti ile..

$count= array();
$poster_number = array();
$query = db_query(
    "SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     AND posterTime > $starttime
     AND posterTime < $endtime", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
    $poster_number[$row['posterName']] = $row['ID_MEMBER'];
}

arsort($count);
$list_number = 0;
foreach ($count as $key => $value)
{
  echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$key] . '">' . $key . '</a> (' . $value . ')<br />';
  ++$list_number;
  if ($list_number > 9) 
    break;
}



LordMidnight


findpeople

meta tag'ı kullanmak istiyorum fakat şu bölüm ilgimi çekti ne anlama geliyor :S

" ben "," sen "," hakkında "," bir "," nerede "," ki "," kim "," nerede "," ve "," com "," de "," en "," için "," tarafından "," nasıl "," ne "," içinde "," ile "," www ",

deniz

onlar yer almamasını istediğin kelimeler. çünkü aramalarda katkısı olmayan şeyler.

findpeople


as_kral

#49
Quote from: deniz on December 24, 2006, 12:59:09 PM
OTOMATÄ°K META TAG


arama motorlarında size büyükk avantaj sağlaycak bir çözüm buldum.

metatag keyword leriniz artık konu başlığına göre değişicek. böylece konuya özel keyword yaratılacak. doalyısıyla konularınızın google gibi arama motorlarında bulunma ve ön sıralara yükselme imkanı yaratılcak. nasıl mı ?

index.template.php dosyasına girip:

function template_main_above()
{
        global $context, $settings, $options, $scripturl, $txt, $modSettings;


altına bu kodu ekliyorsunuz:

$stop_words=  array(" ben "," sen "," hakkında "," bir "," nerede "," ki "," kim "," nerede "," ve "," com "," de "," en "," için "," tarafından "," nasıl "," ne "," içinde "," ile "," www ","!",".","?","=","-");
        $keywords_ = str_replace($stop_words," ",$context['page_title']);
        $keywords_ =  preg_replace ( "/\s\s+/" , " " , $keywords_);
        $keywords_ = str_replace(" ",", ",trim($keywords_));


sonra aşağıdaki satırı
<meta name="keywords" content="....." />

(... olan yerlerde size özel keyworldler veya smf nin kendi klasik keywordleri yer alır)
bununla deÄŸiÅŸtiriyorsunuz:

<meta name="keywords" content="'.$keywords_.'" />


sonucu görmek için herhangi bir konuya girip sayfa kaynağına bakın.

alıntı

Deniz Bu Olmadı sayfa Kaynagında;

<meta name="description" content="Tüm Antrenörlerimiz (Güncel)" />
<meta name="keywords" content="Tüm, Antrenörlerimiz, (Güncel)" />


Böyle Çıkıyor
Yani Sadece Konu Başlığını Alıyor Anahtar Kelime Olarak..