News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Smile Blog

Started by Hoochie Coochie Man, May 31, 2008, 04:49:17 PM

Previous topic - Next topic

Hoochie Coochie Man

Download Linki





Tema adı:Smile Blog
Yazan:Hoochie Coochie Man
Açıklama:Smile Blog teması blog görünümünde bir temadır. Temayı yüklemeden önce, forum seçeneklrinde "Bugün" özelliğini kapatmalısınız ve Varsayılan zaman biçimini aşağıdaki şekilde yapmalısınız..

%d.%m.%Y
Demo:http://smfthemes.890m.com/forum/index.php?theme=13
İnadına SMF 1.1.X

Alpay

Hcm bu index.template.php ekledigin halde messages ve display templatelerde sol kısımda kategolerin cıkaması enteresan bence buna bir çağre bulmalısın ozaman very very nice nice nice tema olucak diye düşünüyorum =)

Hoochie Coochie Man

#2
Oranın kodlarını Eren'nin bloggy'sinden aldım.. Valla bulursa bi o bulur. Bende sende çok uğraştık biliyorum Alpay  :-\

Edit: Zaten öyle birşey olursa SMF de ilk olur :) şimdiye kadar öyle birşey görmedim :)
İnadına SMF 1.1.X

Alpay

Hım... O zaman bir başımızı vuralim daha doğrusu başını vurursan eren arkadaşımıza müsait bir zaman da ilgilenirse gayet iyi olur diye düşünüyorum.

Hoochie Coochie Man

Şuan sanırım hiç müsayit değil.. Yeni default tema ile uğraşıyor.. Yani yaşadınız.. :(
İnadına SMF 1.1.X

Yağız...

#5
Sanirim sorunu buldum.
index.template.php'de su kodun öncesine:
    foreach ($context['categories'] as $category)
Su kodu ekleyip dener misiniz?:
    global $sourcedir;
    require_once($sourcedir . '/BoardIndex.php');

Hoochie Coochie Man

İnadına SMF 1.1.X

Yağız...

Yanlis yapmisim :)
Yenisiyle degistirir misin?

Hoochie Coochie Man

Çoktan değiştirdim yahu :D
İnadına SMF 1.1.X

Yağız...

Local'de calisiyim o zaman. Cözüm bulursam yazarim.

Hoochie Coochie Man

Teşekkürler ilgilendiğin için Yağız.. Kolay gelsin..
İnadına SMF 1.1.X

Yağız...

#11
Simdi denedim ve verdigim kodlar calisti... Hatada yok...

Düzenleme:
Yok olmamis :)
Gözlerim bozuldu iyice :(

Alpay

Ha gayret =) Yağız... Sakin ol bozcan gözleri..

Yağız...

Aslinda o kodlarin orada çalismasi bir mucize :D
SMF'in kodlamasi sayesinde çalisiyor. MessageIndex.php ve Display.php'de kategori kodlari olmadigi için calismiyor. Kategori kodlari sadece BoardIndex.template.php'de olabilir. bloggy!'de de öyle zaten...

forsakenlad

Ben bunu çalıştırdım diğer bölümlerdede bir sonraki bloggy sürümünde yayımlayacağım.
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

[SiNaN]

*eren verecekmiş ama geçici olarak şu şekilde kullanılabilir sanırım.

Load.php

Bul:

?>

Öncesine ekle:

function loadThemeCategories()
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $context, $settings;

// 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.
$result_boards = db_query("
SELECT
c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.description,
b.numPosts, b.numTopics, b.ID_PARENT, IFNULL(m.posterTime, 0) AS posterTime,
IFNULL(mem.memberName, m.posterName) AS posterName, m.subject, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName," . ($user_info['is_guest'] ? "
1 AS isRead, 0 AS new_from" : "
(IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED) AS isRead, IFNULL(lb.ID_MSG, -1) + 1 AS new_from,
c.canCollapse, IFNULL(cc.ID_MEMBER, 0) AS isCollapsed") . ",
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,
IFNULL(mods_mem.ID_MEMBER, 0) AS ID_MODERATOR, mods_mem.realName AS modRealName
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}collapsed_categories AS cc ON (cc.ID_CAT = c.ID_CAT AND cc.ID_MEMBER = $ID_MEMBER)" : '') . "
LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = b.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mods_mem ON (mods_mem.ID_MEMBER = mods.ID_MEMBER)
WHERE $user_info[query_see_board]" . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);

// Run through the categories and boards....
$context['categories'] = array();
while ($row_board = mysql_fetch_assoc($result_boards))
{
// Haven't set this category yet.
if (empty($context['categories'][$row_board['ID_CAT']]))
{
$context['categories'][$row_board['ID_CAT']] = array(
'id' => $row_board['ID_CAT'],
'name' => $row_board['catName'],
'is_collapsed' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1 && $row_board['isCollapsed'] > 0,
'can_collapse' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1,
'collapse_href' => isset($row_board['canCollapse']) ? $scripturl . '?action=collapse;c=' . $row_board['ID_CAT'] . ';sa=' . ($row_board['isCollapsed'] > 0 ? 'expand' : 'collapse;') . '#' . $row_board['ID_CAT'] : '',
'collapse_image' => isset($row_board['canCollapse']) ? '<img src="' . $settings['images_url'] . '/' . ($row_board['isCollapsed'] > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' border="0" />' : '',
'href' => $scripturl . '#' . $row_board['ID_CAT'],
'boards' => array(),
'new' => false
);
$context['categories'][$row_board['ID_CAT']]['link'] = '<a name="' . $row_board['ID_CAT'] . '" href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
}

// If this board has new posts in it (and isn't the recycle bin!) then the category is new.
if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['ID_BOARD'])
$context['categories'][$row_board['ID_CAT']]['new'] |= empty($row_board['isRead']) && $row_board['posterName'] != '';

// Collapsed category - don't do any of this.
if ($context['categories'][$row_board['ID_CAT']]['is_collapsed'])
continue;

// Let's save some typing.  Climbing the array might be slower, anyhow.
$this_category = &$context['categories'][$row_board['ID_CAT']]['boards'];

// This is a parent board.
if (empty($row_board['ID_PARENT']))
{
// Is this a new board, or just another moderator?
if (!isset($this_category[$row_board['ID_BOARD']]))
{
// Not a child.
$isChild = false;

$this_category[$row_board['ID_BOARD']] = array(
'new' => empty($row_board['isRead']),
'id' => $row_board['ID_BOARD'],
'name' => $row_board['boardName'],
'description' => $row_board['description'],
'moderators' => array(),
'link_moderators' => array(),
'children' => array(),
'link_children' => array(),
'children_new' => false,
'topics' => $row_board['numTopics'],
'posts' => $row_board['numPosts'],
'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['boardName'] . '</a>'
);
}
if (!empty($row_board['ID_MODERATOR']))
{
$this_category[$row_board['ID_BOARD']]['moderators'][$row_board['ID_MODERATOR']] = array(
'id' => $row_board['ID_MODERATOR'],
'name' => $row_board['modRealName'],
'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>'
);
$this_category[$row_board['ID_BOARD']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>';
}
}
// Found a child board.... make sure we've found its parent and the child hasn't been set already.
elseif (isset($this_category[$row_board['ID_PARENT']]['children']) && !isset($this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]))
{
// A valid child!
$isChild = true;

$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']] = array(
'id' => $row_board['ID_BOARD'],
'name' => $row_board['boardName'],
'description' => $row_board['description'],
'new' => empty($row_board['isRead']) && $row_board['posterName'] != '',
'topics' => $row_board['numTopics'],
'posts' => $row_board['numPosts'],
'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['boardName'] . '</a>'
);

// Counting child board posts is... slow :/.
if (!empty($modSettings['countChildPosts']))
{
$this_category[$row_board['ID_PARENT']]['posts'] += $row_board['numPosts'];
$this_category[$row_board['ID_PARENT']]['topics'] += $row_board['numTopics'];
}

// Does this board contain new boards?
$this_category[$row_board['ID_PARENT']]['children_new'] |= empty($row_board['isRead']);

// This is easier to use in many cases for the theme....
$this_category[$row_board['ID_PARENT']]['link_children'][] = &$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['link'];
}
// Child of a child... just add it on...
elseif (!empty($modSettings['countChildPosts']))
{
if (!isset($parent_map))
$parent_map = array();

if (!isset($parent_map[$row_board['ID_PARENT']]))
foreach ($this_category as $id => $board)
{
if (!isset($board['children'][$row_board['ID_PARENT']]))
continue;

$parent_map[$row_board['ID_PARENT']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]);
$parent_map[$row_board['ID_BOARD']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]);

break;
}

if (isset($parent_map[$row_board['ID_PARENT']]))
{
$parent_map[$row_board['ID_PARENT']][0]['posts'] += $row_board['numPosts'];
$parent_map[$row_board['ID_PARENT']][0]['topics'] += $row_board['numTopics'];
$parent_map[$row_board['ID_PARENT']][1]['posts'] += $row_board['numPosts'];
$parent_map[$row_board['ID_PARENT']][1]['topics'] += $row_board['numTopics'];

continue;
}

continue;
}
// Found a child of a child - skip.
else
continue;
}
}



index.php

Bul:

// Load the current user's permissions.
loadPermissions();


Sonrasına ekle:

// Load all the categoies and boards for theme.
loadThemeCategories();


Her sayfada BoardIndex.php'yi çağırmak çok mantıklı olmaz. Zaten bizi ilgilendirmeyen bir sürü şey var orada.
Former SMF Core Developer | My Mods | SimplePortal

Yağız...

Ama bu kodlar temayla birlikte yayinlanamaz. Sadece modifikasyon haline getirilip yüklenebilir.

[SiNaN]

Quote from: Yağız on June 01, 2008, 05:41:18 AM
Ama bu kodlar temayla birlikte yayinlanamaz. Sadece modifikasyon haline getirilip yüklenebilir.

Biliyorum Yağız, ama buna dair birşey demedim ki. :)

Quote from: [SiNaN] on June 01, 2008, 05:36:57 AM
*eren verecekmiş ama geçici olarak şu şekilde kullanılabilir sanırım.
Former SMF Core Developer | My Mods | SimplePortal

Yağız...

Başını okumamışım pardon :)

Hoochie Coochie Man

Quote from: *eren on June 01, 2008, 05:31:43 AM
Ben bunu çalıştırdım diğer bölümlerdede bir sonraki bloggy sürümünde yayımlayacağım.

O zaman bir sonra ki bloggy sürümü çıktıktan sonra hemen arkasından kardeş blog "Smile Blog"u update ederiz :P
İnadına SMF 1.1.X

Advertisement: