collapse
Smf GoogleTagged ve Etiket Bulutları Her Sayfada Sitenin En Altında

Kralnetci.Com, kral, kral netci, programlar, oyunlar, eglence, siir edebiyat, resimler, ask, manzara resimleri, guzel sozler, msn, hotmail, nokia, siemens, motorala, samsung, cep telefonlari, video, sinema, programlama, php dersleri, asp dersleri, html dersleri, windows xp, linux isletim sistemi/Smf GoogleTagged ve Etiket Bulutları Her Sayfada Sitenin En Altında => Google tag için BoardIndex.php'de bulun: Kod: [Seç]// Find all boards and categories, as well as related information.  This will be sorted by the

Gönderen Konu: Smf GoogleTagged ve Etiket Bulutları Her Sayfada Sitenin En Altında  (Okunma sayısı 167 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı KraL_BarmeN

  • ADMİN
  • Seviye Beş
  • ******
  • İleti: 538
  • REP 1188
  • Dünyanın Çivisi Çıkmış
    • 34-İSTANBUL
    • Profili Görüntüle
    • Tr-ExpreS
  • Cinsiyet: Bay
Google tag için

BoardIndex.php'de bulun:
Kod: [Seç]
// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
Öncesine ekleyin:
Kod: [Seç]
// Prepare tag cloud.
    $query = db_query("
        SELECT g.tag, g.ID_TAG, g.hits, g.status, g.ID_TOPIC, t.ID_TOPIC
        FROM {$db_prefix}googletagged as g, {$db_prefix}topics as t
        WHERE g.ID_TOPIC = t.ID_TOPIC
            AND g.status != 0
        GROUP BY g.tag
        ORDER BY RAND()
        LIMIT 50", __FILE__, __LINE__);
       
        loadLanguage('GoogleTagged');
       
    // FOUND SOME TAGS?
    if(mysql_num_rows($query) != 0)
    {
        $context['googletagged'] = array();
        $highest = 1;
        $lowest = 999999999999; // SO IT FORCES THE FIRST ROW TO BE THE LOWEST
        while($row = mysql_fetch_assoc($query))
        {
            $context['googletagged'][] = $row;
            $highest = ($row['hits'] > $highest) ? $row['hits'] : $highest;
            $lowest = ($row['hits'] < $lowest) ? $row['hits'] : $lowest;
        }
        unset($row);
        $maxsize = 200;
        $minsize = 100;
        $diff = ($highest - $lowest == 0) ? 1 : ($highest - $lowest);
        $steps = ($maxsize - $minsize)/$diff;

        foreach ($context['googletagged'] as $key => $row)
        {       
            $context['googletagged'][$key]['size'] = ceil($minsize + ($steps * ($row['hits'] - $lowest)));
            $context['googletagged'][$key]['text'] = str_replace("+", " ", $context['googletagged'][$key]['tag']);
        }
        unset($key,$row,$steps,$highest,$lowest,$maxsize,$minsize);
        mysql_free_result($query);
    }

BoardIndex.template.php'de bulun:
Kod: [Seç]
}

?>

Öncesine ekleyin:
Kod: [Seç]
echo '
    <table border="0" cellpadding="4" cellspacing="0" align="center" width="80%" class="tborder">
        <tr class="titlebg">
            <td align="center">
                ', $txt['googletagged_random50'], '
            </td>
        </tr>
        <tr>
            <td align="center" class="windowbg2">';

    if(isset($context['googletagged']))
    {
        $i = 1;
        foreach($context['googletagged'] as $key => $row)
        {
            echo '  <a href="', $scripturl , '?action=tagged;id=', $row['ID_TAG'] ,';tag=', $row['tag'] ,'" style="font-size: '.$row['size'].'%;" title="', $row['text'] ,'">', $row['text'] ,'</a>';
            echo (($i % 10) == 0) ? '<br/>' : '';
            $i++;
        }
        unset($i,$key,$row);
    }
    else
    {
        echo $txt['googletagged_empty'];
    }
    echo '
            </td>
        </tr>
      </table>';

Etiket ( smf tag ) için

Sources/BoardIndex.php'de bulun:

Kod: [Seç]
// Remember the most recent topic for optimizing the recent posts feature.
    $most_recent_topic = array(
        'timestamp' => 0,
        'ref' => null
    );

Sonrasina ekleyin:
Kod: [Seç]
//Tag cloud from http://www.prism-perfect.net/archive/php-tag-cloud-tutorial/       
    $query = "SELECT t.tag AS tag, l.ID_TAG, COUNT(l.ID_TAG) AS quantity
        FROM {$db_prefix}tags as t, {$db_prefix}tags_log as l WHERE t.ID_TAG = l.ID_TAG
        GROUP BY l.ID_TAG
        ORDER BY l.ID DESC LIMIT 50";
    $result = db_query($query, __FILE__, __LINE__);
       
    // here we loop through the results and put them into a simple array:
    // $tag['thing1'] = 12;
    // $tag['thing2'] = 25;
    // etc. so we can use all the nifty array functions
    // to calculate the font-size of each tag
    $tags = array();
    $tags2 = array();
    while ($row = mysql_fetch_array($result))
    {
        $tags[$row['tag']] = $row['quantity'];
        $tags2[$row['tag']] = $row['ID_TAG'];
    }
       
    if(count($tags2) > 0)
    {
        // change these font sizes if you will
        $max_size = 250; // max font size in %
        $min_size = 100; // min font size in %
       
        // get the largest and smallest array values
        $max_qty = max(array_values($tags));
        $min_qty = min(array_values($tags));
       
        // find the range of values
        $spread = $max_qty - $min_qty;
        if (0 == $spread)
        { // we don't want to divide by zero
            $spread = 1;
        }
           
        // determine the font-size increment
        // this is the increase per tag quantity (times used)
        $step = ($max_size - $min_size)/($spread);
           
        // loop through our tag array
        $context['poptags'] = '';
        $row_count = 0;
        foreach ($tags as $key => $value)
        {
            $row_count++;
            // calculate CSS font-size
            // find the $value in excess of $min_qty
            // multiply by the font-size increment ($size)
            // and add the $min_size set above
            $size = $min_size + (($value - $min_qty) * $step);
            // uncomment if you want sizes in whole %:
            // $size = ceil($size);
       
            // you'll need to put the link destination in place of the #
            // (assuming your tag links to some sort of details page)
            $context['poptags'] .= '<a href="' . $scripturl . '?action=tags;id=' . $tags2[$key] . '" style="font-size: '.$size.'%"';
            // perhaps adjust this title attribute for the things that are tagged
            $context['poptags'] .= ' title="'.$value.' things tagged with '.$key.'"';
            $context['poptags'] .= '>'.$key.'</a> ';
            if ($row_count > 5)
            {
                $context['poptags'] .= '<br />';
                $row_count =0;
            }
            // notice the space at the end of the link
        }
    }

Themes/temaniz/BoardIndex.template.php'de bulun:
Kod: [Seç]
}

?>

Öncesine ekleyin:

Kod: [Seç]
echo '<br />
    <table border="1" cellpadding="5" cellspacing="0" align="center" width="100%">
        <tr>
            <td align="center"  class="catbg">Etiketler</td>
        </tr>
        <tr>
            <td align="center" class="windowbg2">';
            if(isset($context['poptags']))
                echo $context['poptags'];
            echo '
            </td>
        </tr>
    </table>';



Alıntıdır: Smf.Gen.Tr Sitesinden.

KraL_BarmeN