• 04-03-2010, 11:57:32
    #1
    Merhaba arkadaşlar... Size uzun zamandır çözümünü bulamadığım bir soruyu sormak istiyorum... Smf forumumda TinyPortal Kullanıyorum ve TinyPortal'da blok olarak tüm forum kategorilerini gösteriyorum...

    global $db_prefix, $context, $user_info;
    
    
    	// Find the boards/cateogories they can see.
    	$request = db_query("
    		SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.numTopics, b.childLevel
    		FROM {$db_prefix}boards AS b
    			LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
    		WHERE $user_info[query_see_board]", __FILE__, __LINE__);
    	$context['jump_to'] = array();
    	$this_cat = array('id' => 5);
    	while ($row = mysql_fetch_assoc($request))
    	{
    		if ($this_cat['id'] != $row['ID_CAT'])
    		{
    			$this_cat = &$context['jump_to'][];
    			$this_cat['id'] = $row['ID_CAT'];
    			$this_cat['name'] = $row['catName'];
    			$this_cat['boards'] = array();
    		}
    
    		$this_cat['boards'][] = array(
    			'id' => $row['ID_BOARD'],
    			'name' => $row['boardName'],
    			'child_level' => $row['childLevel'],
    			'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board'],
    			'topics' => $row['numTopics']
    		);
    	}
    	mysql_free_result($request);
    
    	foreach ($context['jump_to'] as $category){
    		// edit the following line if you want to change the style of the category text.				
    		echo '<span style="line-height: 10px; font-weight: bold;" class="normaltext" ><b>', strtoupper($category['name']), '</b></span><br />';	
    	
    		foreach ($category['boards'] as $board){
                if (!$board['child_level']){
    				//edit the following line for the regular board text
    				echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><br />';
    				//this line you can edit for the topics count text
    				echo '<span class="smalltext" style="margin-left: 10px;">', $board['topics'],' ', $txt[330], '</span><br />';
    			}
    			else{
    				//this line you can edit to change the child board text
    				echo '<a class="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
    			}
             
    		}
    	}
    Kod bu arkadaşlar.. İstediğim şey ise sadece belli bir kategoriyi blokta göstermek.. Yani tüm forum kategorileri yerine kategori 5'i tüm alt kategorileriyle birlikte blokta göstermek istiyorum, kodun neresinde değişiklik yapmam gerekir acaba? Şimdiden teşekkürler, iyi günler...
  • 04-03-2010, 19:12:40
    #2
    global $db_prefix, $context, $user_info;
    
    
    	// Find the boards/cateogories they can see.
    	$request = db_query("
    		SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.numTopics, b.childLevel
    		FROM {$db_prefix}boards AS b
    			LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
    		WHERE $user_info[query_see_board]
    				AND c.ID_CAT = 5", __FILE__, __LINE__);
    	$context['jump_to'] = array();
    	$this_cat = array('id' => 5);
    	while ($row = mysql_fetch_assoc($request))
    	{
    		if ($this_cat['id'] != $row['ID_CAT'])
    		{
    			$this_cat = &$context['jump_to'][];
    			$this_cat['id'] = $row['ID_CAT'];
    			$this_cat['name'] = $row['catName'];
    			$this_cat['boards'] = array();
    		}
    
    		$this_cat['boards'][] = array(
    			'id' => $row['ID_BOARD'],
    			'name' => $row['boardName'],
    			'child_level' => $row['childLevel'],
    			'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board'],
    			'topics' => $row['numTopics']
    		);
    	}
    	mysql_free_result($request);
    
    	foreach ($context['jump_to'] as $category){
    		// edit the following line if you want to change the style of the category text.				
    		echo '<span style="line-height: 10px; font-weight: bold;" class="normaltext" ><b>', strtoupper($category['name']), '</b></span><br />';	
    	
    		foreach ($category['boards'] as $board){
                if (!$board['child_level']){
    				//edit the following line for the regular board text
    				echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><br />';
    				//this line you can edit for the topics count text
    				echo '<span class="smalltext" style="margin-left: 10px;">', $board['topics'],' ', $txt[330], '</span><br />';
    			}
    			else{
    				//this line you can edit to change the child board text
    				echo '<a class="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
    			}
             
    		}
    	}
  • 05-03-2010, 18:26:36
    #3
    Hocam Allah razı olsun çok teşekkürler.. simplemachines.org da bile cevabını alamamıştım.. Tinyportal forumunda ise Türkçe bölümünde hiç cevap alamadım... Verdiğin kod süper bir şekilde çalıştı istediğimdende öte çok güzel oldu

    Ellerine sağlık... Rep vermeye çalıştım umarım olmuştur

    Bu arada son bir soru, o kategoride istemediğim bölüm yani board varsa onu nasıl çıkartırım hocam?
  • 05-03-2010, 19:02:39
    #4
    Simplemachines.org'da nerede yazdınız? Cevap vermediğim konu çok nadirdir

    global $db_prefix, $context, $user_info;
    
    
        // Find the boards/cateogories they can see.
        $request = db_query("
            SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.numTopics, b.childLevel
            FROM {$db_prefix}boards AS b
                LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
            WHERE $user_info[query_see_board]
                    AND c.ID_CAT = 5
                    AND b.ID_BOARD NOT IN (bolum_id (birden fazla yazacaksanız virgülle ayırın))", __FILE__, __LINE__);
        $context['jump_to'] = array();
        $this_cat = array('id' => 5);
        while ($row = mysql_fetch_assoc($request))
        {
            if ($this_cat['id'] != $row['ID_CAT'])
            {
                $this_cat = &$context['jump_to'][];
                $this_cat['id'] = $row['ID_CAT'];
                $this_cat['name'] = $row['catName'];
                $this_cat['boards'] = array();
            }
    
            $this_cat['boards'][] = array(
                'id' => $row['ID_BOARD'],
                'name' => $row['boardName'],
                'child_level' => $row['childLevel'],
                'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board'],
                'topics' => $row['numTopics']
            );
        }
        mysql_free_result($request);
    
        foreach ($context['jump_to'] as $category){
            // edit the following line if you want to change the style of the category text.                
            echo '<span style="line-height: 10px; font-weight: bold;" class="normaltext" ><b>', strtoupper($category['name']), '</b></span><br />';    
        
            foreach ($category['boards'] as $board){
                if (!$board['child_level']){
                    //edit the following line for the regular board text
                    echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><br />';
                    //this line you can edit for the topics count text
                    echo '<span class="smalltext" style="margin-left: 10px;">', $board['topics'],' ', $txt[330], '</span><br />';
                }
                else{
                    //this line you can edit to change the child board text
                    echo '<a class="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
                }
             
            }
        }
  • 05-03-2010, 19:27:42
    #5
    O kadar çok yerde konu açtım ki hocam.. İnanamazsın Ve şimdi sorunu çözdüm çok teşekkürler..

    2. Verdiğin kodda istediğim gibi oldu.. Ellerine sağlık