SSI Dersleri - Orta Seviye

Started by [SiNaN], May 21, 2008, 10:31:21 AM

Previous topic - Next topic

Hkan

@Gok86; array yöntemini kullanabilirsin. Bu konuda ilk mesajın son kodundaki HTML kodlarını düzenleyerek yapabilirsin.


Hkan

ssi_topBoards(); olayı ile yapacaksınız siz. ;)

S_HA_DO_W

Quote from: biggboss on August 17, 2009, 10:19:26 AM
ssi_topBoards(); olayı ile yapacaksınız siz. ;)
biliyorum ama istediğim şekilde olmuyor
istediğim olay bütün bölümler sabit kalacak 10 adet değil ne kadar varsa kategoride o kadar bölümü çekecek
ve her kategorini bölümlerini ayrı ayrı alacağım

ssi_topBoards();
olayında ise bütün kategorilerin bölümleri alınıyor ve hangi kategoriye yazılırsa yazılsın herhangi bir bölümü en üste atıyor
ben ise sabit kalmasını ve 10 ile sınırlı kalmasını istemiyorum


her kategoriye göre ayrı ayrı alma olayını ve sabit kalması olayını beceremedim zaten önemli olan kısmıda orası
10 tane kısmını fonksiyonu karıştırarak buldum ama onun sayısını arttırmak şuanda işime yaramaz
dediğim özellikleri yapamadıktan sonra

S_HA_DO_W

2 gündür pc başında birisi yardım eder diye bekliyorum ilgilenebilecek kimse yok mu

Arbalot

topBoards fonksiyonunda aşağıdaki sql de bulunan

ORDER BY b.numPosts DESC
LIMIT $num_top


ifadesini kaldırıp bir dene olmazsa oraya bunu ekle bir dene

ORDER BY b.boardOrder DESC

$request = db_query("
SELECT
b.name, b.numTopics, b.numPosts, b.ID_BOARD," . (!$user_info['is_guest'] ? ' 1 AS isRead' : '
(IFNULL(lb.ID_MSG, 0) >= b.ID_LAST_MSG) AS isRead') . "
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = $ID_MEMBER)
WHERE $user_info[query_see_board]" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "
ORDER BY b.numPosts DESC
LIMIT $num_top", __FILE__, __LINE__);

S_HA_DO_W

Quote from: Arbalot on August 19, 2009, 02:35:09 AM
topBoards fonksiyonunda aşağıdaki sql de bulunan

ORDER BY b.numPosts DESC
LIMIT $num_top


ifadesini kaldırıp bir dene olmazsa oraya bunu ekle bir dene

ORDER BY b.boardOrder DESC


bu şekilde yapınca forumdaki sırası ile geliyor hocam teşekkürler
peki bunu id bazında çekebilir miyiz
yani şöyle id = 5 olan kategoriye göre bölümleri almak istiyorum sadece
sonrada id = 10 olanı çekeceğim sadece bu iki id ye sahip konuları çekmek istiyorum
yada istediğim herhangi birkaç kategori id sine göre çekmek için ne yapmam gerekiyor
yani kategorileri istediğim gibi çekip ayrı ayrı yerlerde yayınlamak için ne yapabilir.

Arbalot

sorguda bulunan

AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "

yukarıdaki kodları bulun ve aşağıdakiler ile değiştirin

AND b.ID_CAT IN(1,2,3) AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "

orda parantez içine virgülle ayırarak kategori idlerini yazabilirsiniz.

S_HA_DO_W

Quote from: Arbalot on August 20, 2009, 01:31:35 AM
sorguda bulunan

AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "

yukarıdaki kodları bulun ve aşağıdakiler ile değiştirin

AND b.ID_CAT IN(1,2,3) AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "

orda parantez içine virgülle ayırarak kategori idlerini yazabilirsiniz.

usta dediklerinizi harfiyen yapmama rahmen olmuyor
ilk verdiğinizde o kodu siliyorum forumdaki sıraya göre geliyor
sonra verdiğini kodu eklediğimde ise
sayfa görüntülenemiyor hatası veriyor
ne yapmam gerekiyor

Özgür

Resimler uçtuğu için ne yapmak istediğinizi tam çözemedim. Tam oalrak ne yapmak istiyorsunuz?
So Long

S_HA_DO_W

Quote from: [Daydreamer] on August 25, 2009, 05:27:09 AM
Resimler uçtuğu için ne yapmak istediğinizi tam çözemedim. Tam oalrak ne yapmak istiyorsunuz?
yapmak istediğim tam olarak şu mesela ben 2 ve 5 id li kategorinin bölüm adlarını konu ve mesaj sayılarını çekmek istiyorum
ama mesaj yazdıkça üste taşımayacak sürekli forumdaki sırası ile kalacak umarım açıklayacı olmuştur
eğer anlatamadıysam resimler ile baştan anlatmaya çalışabilirim isterseniz

S_HA_DO_W

şu şekilde de olabilir aslında istediğim bi kategorinin id sini yazıp sadece o kategorinin bilgilerini çeksede olur
gerekirse foksiyonun adını değiştirir farklı bi kategori için düzenleyebilir yani tek bir kategorinin bilgilerini çeksede olur

Gökhan | Brestgerfich

3 farklı bölümden son mesajları almak istedigimizde ne yapmalıyız peki Sinan?
Farklı tabloda değil de hepsini aynı tabloda göstermek istedigimizi düşünürsek ?

S_HA_DO_W

arkadaşlar yardımlarınızı bekliyorum

Arbalot

@S_HA_DO_W benim verdiğim kodları deneyip bana site adresini verebilirmisin?

S_HA_DO_W

Quote from: Arbalot on August 28, 2009, 04:14:30 AM
@S_HA_DO_W benim verdiğim kodları deneyip bana site adresini verebilirmisin?
şuanda sizin verdiğiniz ssi.php kodları ekledim usta
adres bu
http://www.add-search-engine.co.cc/ornate/ornate/
şuanda deneme amaçlı ücretsiz bi yerde yapıyorum bu istediğimi başarırsam domain ve hostingi yaptığım gün alıp başlayacağım
forum adresi ise
http://www.add-search-engine.co.cc/smf

ssi_topboards kodlarının hepsini yapıştırıyorum buraya üstad
function ssi_topBoards($num_top = 15, $output_method = 'echo')
{
global $context, $settings, $db_prefix, $txt, $scripturl, $user_info, $modSettings, $smcFunc;

// Find boards with lots of posts.
$request = $smcFunc['db_query']('', '
SELECT
b.name, b.num_topics, b.num_posts, b.id_board,' . (!$user_info['is_guest'] ? ' 1 AS is_read' : '
(IFNULL(lb.id_msg, 0) >= b.id_last_msg) AS is_read') . '
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}log_boards AS lb ON (lb.id_board = b.id_board AND lb.id_member = {int:current_member})
WHERE {query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.ID_CAT IN(1,2) AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : '') . "
ORDER BY b.boardOrder DESC
LIMIT ' . $num_top,
array(
'current_member' => $user_info['id'],
'recycle_board' => (int) $modSettings['recycle_board'],
)
);
$boards = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$boards[] = array(
'id' => $row['id_board'],
'num_posts' => $row['num_posts'],
'num_topics' => $row['num_topics'],
'name' => $row['name'],
'new' => empty($row['is_read']),
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'
);
$smcFunc['db_free_result']($request);

// If we shouldn't output or have nothing to output, just jump out.
if ($output_method != 'echo' || empty($boards))
return $boards;

echo '
<table class="ssi_table">
<tr>
<th align="left">', $txt['board'], '</th>
<th align="left">', $txt['board_topics'], '</th>
<th align="left">', $txt['posts'], '</th>
</tr>';
foreach ($boards as $board)
echo '
<tr>
<td>', $board['link'], $board['new'] ? ' <a href="' . $board['href'] . '"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>' : '', '</td>
<td align="right">', $board['num_topics'], '</td>
<td align="right">', $board['num_posts'], '</td>
</tr>';
echo '
</table>';
}

S_HA_DO_W

günlerdir bekliyorum hiç kimse yardım etmeyecek mi arkadaşlar yaa
istediğim şey ortada benim istediğim herhangi bi kategorinin bölüm adlarını konu ve mesaj sayılarını alacak bu kadar

Özgür

Tüm kategorileri ve bölüm adlarını almak için ben şu kodları kullanıyordum.
<?php
global $sourcedir$context$modSettings$scripturl;
echo
'<style type="text/css">
ul.sitemap
{
   margin-left: 25px;
   padding: 0;
   list-style: none;
}

ul.sitemap li
{
background:transparent url(http://www.rockayseri.net/rk/Themes/rockayseri/images/profil/arrow.gif) no-repeat scroll 5px 9px;
   padding: 4px 0 4px 30px;
}
ul.sitemap li ul li
{
   padding: 4px 0 4px 30px;
}</style>'
;
   
// Retrieve the categories and boards.
   
require_once($sourcedir '/Subs-BoardIndex.php');
   
$boardIndexOptions = array(
      
'include_categories' => true,
      
'base_level' => 0,
      
'parent_id' => 0,
      
'set_latest_post' => true,
      
'countChildPosts' => !empty($modSettings['countChildPosts']),
   );
   
$context['categories'] = getBoardIndex($boardIndexOptions);

   echo 
'
   <ul class="sitemap">'
;
   foreach (
$context['categories'] as $category)
   {
      echo 
'
      <li>'
$category['link'];
         echo 
'
         <ul>'
;
         foreach (
$category['boards'] as $board)
         {
            echo 
'
            <li><a href="'
$board['href'], '" name="b'$board['id'], '">'$board['name'], '</a>';
               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)
               {
                     
$child['link'] = '<a href="http://demo.rockayseri.net/' $child['href'] . '" title="' $child['posts'] . ' ' $txt['redirects'] . '">' $child['name'] . '</a>';



                  
$children[] = $child['new'] ? '<strong>' $child['link'] . '</strong>' $child['link'];
               }
               echo 
'<ul><li style="font-size:10px;">'$txt['parent_boards'], ' : 'implode(', '$children), '</li></ul>';
            }
            echo
'</li>';
         }
         echo 
'
         </ul>
      </li>'
;
   }
   echo 
'
   </ul>'
;
   
?>

Yapmak istediğiniz bunun gibi birşey mi?
So Long

S_HA_DO_W

Quote from: [Daydreamer] on September 06, 2009, 12:19:15 PM
Tüm kategorileri ve bölüm adlarını almak için ben şu kodları kullanıyordum.
<?php
global $sourcedir$context$modSettings$scripturl;
echo
'<style type="text/css">
ul.sitemap
{
   margin-left: 25px;
   padding: 0;
   list-style: none;
}

ul.sitemap li
{
background:transparent url(http://www.rockayseri.net/rk/Themes/rockayseri/images/profil/arrow.gif) no-repeat scroll 5px 9px;
   padding: 4px 0 4px 30px;
}
ul.sitemap li ul li
{
   padding: 4px 0 4px 30px;
}</style>'
;
   
// Retrieve the categories and boards.
   
require_once($sourcedir '/Subs-BoardIndex.php');
   
$boardIndexOptions = array(
      
'include_categories' => true,
      
'base_level' => 0,
      
'parent_id' => 0,
      
'set_latest_post' => true,
      
'countChildPosts' => !empty($modSettings['countChildPosts']),
   );
   
$context['categories'] = getBoardIndex($boardIndexOptions);

   echo 
'
   <ul class="sitemap">'
;
   foreach (
$context['categories'] as $category)
   {
      echo 
'
      <li>'
$category['link'];
         echo 
'
         <ul>'
;
         foreach (
$category['boards'] as $board)
         {
            echo 
'
            <li><a href="'
$board['href'], '" name="b'$board['id'], '">'$board['name'], '</a>';
               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)
               {
                     
$child['link'] = '<a href="http://demo.rockayseri.net/' $child['href'] . '" title="' $child['posts'] . ' ' $txt['redirects'] . '">' $child['name'] . '</a>';



                  
$children[] = $child['new'] ? '<strong>' $child['link'] . '</strong>' $child['link'];
               }
               echo 
'<ul><li style="font-size:10px;">'$txt['parent_boards'], ' : 'implode(', '$children), '</li></ul>';
            }
            echo
'</li>';
         }
         echo 
'
         </ul>
      </li>'
;
   }
   echo 
'
   </ul>'
;
   
?>

Yapmak istediğiniz bunun gibi birşey mi?

bütün kategorileri almak değilde sadece 1 tanesini almak hocam
yani benim id sini yazdığım 1 tane kategoriyi alacak ve onun bölümlerini vs. bilgilerini alacak
ama yazılan mesaja göre üste falan atmayacak forumdaki göründüğü sıra ile çekecek yani

Özgür

Hmm..
<?php
global $sourcedir$context$modSettings$scripturl;
echo
'<style type="text/css">
ul.sitemap
{
   margin-left: 25px;
   padding: 0;
   list-style: none;
}

ul.sitemap li
{
background:transparent url(http://www.rockayseri.net/rk/Themes/rockayseri/images/profil/arrow.gif) no-repeat scroll 5px 9px;
   padding: 4px 0 4px 30px;
}
ul.sitemap li ul li
{
   padding: 4px 0 4px 30px;
}</style>'
;
   
// Retrieve the categories and boards.
   
require_once($sourcedir '/Subs-BoardIndex.php');
   
$boardIndexOptions = array(
      
'include_categories' => true,
      
'base_level' => 0,
      
'parent_id' => 0,
      
'set_latest_post' => true,
      
'countChildPosts' => !empty($modSettings['countChildPosts']),
   );
   
$context['categories'] = getBoardIndex($boardIndexOptions);

   echo 
'
   <ul class="sitemap">'
;
   foreach (
$context['categories'] as $category)
   {
      echo 
'
      <li>'
$category['link'];
         echo 
'
         <ul>'
;
         foreach (
$category['boards'] as $board)
         {
         if (
$category['id'] == 5)
{
            echo 
'
            <li><a href="'
$board['href'], '" name="b'$board['id'], '">'$board['name'], '</a>';
               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)
               {
                     
$child['link'] = '<a href="http://demo.rockayseri.net/' $child['href'] . '" title="' $child['posts'] . ' ' $txt['redirects'] . '">' $child['name'] . '</a>';



                  
$children[] = $child['new'] ? '<strong>' $child['link'] . '</strong>' $child['link'];
               }
               echo 
'<ul><li style="font-size:10px;">'$txt['parent_boards'], ' : 'implode(', '$children), '</li></ul>';
            }
            echo
'</li>';
         }
         else
         {
         echo
'';}
         
         echo 
'
         </ul>
      </li>'
;
   }
   echo 
'
   </ul>'
;
   
?>


  if ($category['id'] == 5) daki 5 yerine gerekli kategori idsini yazmayı deneyin.
Oluşan şey sizin istediğiniz gibi mi? Eğer öyleyse kalanını kolay :)
So Long

Advertisement: