News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Ana Sayfada Kutu Şeklinde Kategoriler

Started by Antes, August 01, 2011, 05:27:42 PM

Previous topic - Next topic

Antes

Bugün bi dostumun isteği üzerine biraz çalıştım. İşin sonunda gayet hoş bi yapı ortaya çıktı ve sizlerle paylaşmak istedim.

BoardIndex.template.php
Code (Bul) Select
                echo '
                <tr id="board_', $board['id'], '" class="windowbg2">
                    <td class="icon windowbg"', !empty($board['children']) ? ' rowspan="2"' : '', '>
                        <a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';

                // If the board or children is new, show an indicator.
                if ($board['new'] || $board['children_new'])
                    echo '
                            <img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
                // Is it a redirection board?
                elseif ($board['is_redirect'])
                    echo '
                            <img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
                // No new posts at all! The agony!!
                else
                    echo '
                            <img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';

                echo '
                        </a>
                    </td>
                    <td class="info">
                        <a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';

                // Has it outstanding posts for approval?
                if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
                    echo '
                        <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';

                echo '

                        <p>', $board['description'] , '</p>';

                // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
                if (!empty($board['moderators']))
                    echo '
                        <p class="moderators">', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';

                // Show some basic information about the number of posts, etc.
                    echo '
                    </td>
                    <td class="stats windowbg">
                        <p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
                        ', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
                        </p>
                    </td>
                    <td class="lastpost">';

                /* The board's and children's 'last_post's have:
                time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
                link, href, subject, start (where they should go for the first unread post.),
                and member. (which has id, name, link, href, username in it.) */
                if (!empty($board['last_post']['id']))
                    echo '
                        <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
                        ', $txt['in'], ' ', $board['last_post']['link'], '<br />
                        ', $txt['on'], ' ', $board['last_post']['time'],'
                        </p>';
                echo '
                    </td>
                </tr>';
                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                if (!empty($board['children']))
                {
                    // Sort the links into an array with new boards bold so it can be imploded.
                    $children = array();
                    /* Each child in each board's children has:
                            id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                    foreach ($board['children'] as $child)
                    {
                        if (!$child['is_redirect'])
                            $child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" />' : '') . '</a>';
                        else
                            $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

                        // Has it posts awaiting approval?
                        if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
                            $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';

                        $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
                    }
                    echo '
                    <tr id="board_', $board['id'], '_children">
                        <td colspan="3" class="children windowbg">
                            <strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '
                        </td>
                    </tr>';
                }
            }
        echo '
            </tbody>';

Code (Değiştir) Select
// Boxed BoardIndex Start
            echo '
    <tr class="catbox windowbg2">';

            echo '
        <td class="info">
<div class="box100">
<div class="catbox-all">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>
<p>', $board['description'] , '</p>';
                 
            if (!empty($board['last_post']['id']))     
            echo '   
            <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
            ', $txt['in'], ' ', $board['last_post']['link'], '<br />
            ', $txt['on'], ' ', $board['last_post']['time'],'
            </p>';

            echo '
</div>
</div>
        </td>
    </tr>';

         }
      echo '
         </tbody>';
// Boxed BoardIndex End


Index.css
Code (Sonuna Ekle) Select

.catbox
{
   height: 150px;
   float: left;
   margin-bottom: 1%;
}
.catbox-all
{
   width:260px;
   height:150px;
   -webkit-border-radius: 10px;
   -moz-border-radius: 10px;
   border-radius: 10px;
   background-color: #dadfe6;
   padding-left: 3%;
   padding-top: 3%;
}



Kodların XHTML sorunlarını çözen ve kalanları çözmemde yardımcı olan MrGrumpy 'ye çok teşekkür ederim.


Antes

Sürüm 0.0.3
* XHTML sorunları düzeltildi.

Eğer birileri bunu kullanıyosa :P lütfen çok acil yeni sürüme geçsin.

a11

Çok özür dilerim, bunu 1.1.x sürüm için yapabilir miyiz ?

Antes

Ben geriye dönük çalışma yapmıyorum fakat istekli bi arkadaş varsa kodlarımı kaynak belirterek veya belirtmeden kullanabilir.

a11

Sağlık olsun, ilginiz için teşekkür ederim.

bolubeyi61

Geliştirilmişi mevcut ama 1 serisi için değil:
Şurada paket olarak verilmiş: http://custom.simplemachines.org/mods/index.php?mod=1720
Demosu da şurada var: http://www.kuluckalik.com/index.php

Evo™

Quote from: Mavice on January 28, 2013, 02:29:50 PM
Sağlık olsun, ilginiz için teşekkür ederim.
Bu isteklerinize cevap ise tasarım ile ilgili uyarlama yapabilirim.

a11

Quote from: Evo™ on January 28, 2013, 05:18:29 PM
Bu isteklerinize cevap ise tasarım ile ilgili uyarlama yapabilirim.

Çok teşekkür ederim ilginize, vermiş olduğunuz linkteki düzenlemeleri yaptım. Mümkün olabilirse tasarım ile ilgili uyarlamayı yaparsanız minnettar kalırım. Tekrar teşekkür ederim.

Evo™

Tasarım ile ilgili uyarlama yapmak yerine konuda belirtilenin 1.1.x serisine uyumunun daha basit olduğuna karar verdim ve onu uyguladım.
Örneği buradan görebilirsiniz.
Yapılacak değişikliğe gelir isek; Index.css'ye eklenmesi gereken kodlar style.css'ye eklenmelidir.
Boardindex.template.php açın
Code (Bulun) Select
/* Each board in each category's boards has:
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
children (see below.), link_children (easier to use.), children_new (are they new?),
topics (# of), posts (# of), link, href, and last_post. (see below.) */
foreach ($category['boards'] as $board)
{
echo '
<tr>
<td ' , !empty($board['children']) ? 'rowspan="2"' : '' , ' class="windowbg" width="6%" align="center" valign="top"><a href="', $scripturl, '?action=unread;board=', $board['id'], '.0">';

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="', $settings['images_url'], '/on.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// This board doesn't have new posts, but its children do.
elseif ($board['children_new'])
echo '<img src="', $settings['images_url'], '/on2.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// No new posts at all! The agony!!
else
echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt[334], '" title="', $txt[334], '" />';

echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];

// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['moderators']))
echo '
<div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="windowbg" valign="middle" align="center" style="width: 12ex;"><span class="smalltext">
', $board['posts'], ' ', $txt[21], ' <br />
', $board['topics'],' ', $txt[330], '
</span></td>
<td class="windowbg2" valign="middle" width="22%">
<span class="smalltext">';

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];
echo '
</span>
</td>
</tr>';


Code (Değiştir) Select
/* Each board in each category's boards has:
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
children (see below.), link_children (easier to use.), children_new (are they new?),
topics (# of), posts (# of), link, href, and last_post. (see below.) */
foreach ($category['boards'] as $board)
{
      // Boxed BoardIndex Start
            echo '
            <tr class="catbox windowbg2">';

            echo '
            <td class="info">
            <div class="catbox-title">
            <a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a> <a href="./index.php?action=.xml;type=rss2;sa=recent;board=', $board['id'], '"><img src="./Themes/default/images/feed16.png" alt="feed icon" /></a>
            </div>';
           
            echo '   
            <div class="catbox-description">
            <p>', $board['description'] , '</p>
            </div>
            <hr/>';
                 
            if (!empty($board['last_post']['id']))     
            echo '   
            <div class="catbox-lastinfo">
            <p>', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '
', $txt[30], ' ', $board['last_post']['time'];
echo'
            </p>
            </div>';

            echo '
            </td>
            </tr>';


crazy_man

Boards in Categories: http://custom.simplemachines.org/mods/index.php?mod=1720

yukarıdaki modu kurdum... SMF 2.0.7 sürümde sorunsuz çalışıyor.

Resimlerle aradaki kaymaları ayarlamaya çalıştım.  ;)

İncelemek isteyen bakabilir: http://www.uyanangenclik.com/index.php
Bir Damlasıyım Okyanusun...Ama Okyanusum. (I'm a Drop of the Ocean... But I'm the Ocean.)
Uyanan Gençlik
Arif Hocam

a11


bolubeyi61

Çok güzel olmuş tebrikler. xhtml hatalarını düzeltirseniz daha iyi olacaktır.


a11

Teşekkürler, sayenizde:)
Bu xhtml hatalarında da öyle abuk sabuk şeyler çıkıyor ki, nasıl düzeltilecek belli değil.

Snrj


Antes

Benim bunu sıfırdan yazmam şart :( boş bi vaktimde mutlaka tekrardan yazıcam bunu.

a11


Antes

Quote from: Mavice on March 20, 2014, 01:46:26 PM
Olmamış mı ki ? :)

Görsel olarak bi sorun yok ama xHTML hatalarını gidermek gerekli.

plaket



Advertisement: