SimplePortal

Support => English Support => Topic started by: iobit on April 24, 2011, 12:51:12 PM

Title: double name in category block
Post by: iobit on April 24, 2011, 12:51:12 PM
Hello,
why appear double the name of category?

Read Before Posting
-Read Before Posting (1)

all two link are clickable how to browse only one?

thanks in advanced
Title: Re: double name in category block
Post by: [SiNaN] on April 25, 2011, 09:42:12 AM
It'll be displayed like this:

{category name}
{board name}
-{child board name}

It's related to your board structure. So from what I understand:

Read Before Posting => category
-Read Before Posting (1) => board

So you probably have the category name the same as the board name.
Title: Re: double name in category block
Post by: iobit on April 26, 2011, 12:02:56 PM
thanks for reply

is right, how can I display only the category,(noduble name) so that when a user click enter into the category?
thanks
Title: Re: double name in category block
Post by: AngelinaBelle on April 27, 2011, 07:45:43 AM
You are talking about the custom block from your earlier topic? http://simpleportal.net/index.php?topic=8721.msg46494#msg46494 (http://simpleportal.net/index.php?topic=8721.msg46494#msg46494)
I am  not sure what you mean by "enter into the category".
Do you mean to say
* First, show only the categories
* When the user clicks on a category, show the boards in the category
This would look similar to what you see now at http://simpleportal.net/index.php?action=forum (http://simpleportal.net/index.php?action=forum), where the category expands of collapses when you click on it? Similar to the way you can collapse or expand a SimplePortal block by clicking on the icon in its title?
Title: Re: double name in category block
Post by: [SiNaN] on April 28, 2011, 07:24:35 AM
I guess it's the terminology that's causes the problem.

A 'category' holds boards.
A 'board' holds topics.

See if this block code does what you want:

Code: [Select]
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $user_info, $db_prefix;

$block_parameters = array(
'num_children' => 'int',
);

if ($return_parameters)
return $block_parameters;

$child_depth = !empty($parameters['num_children']) ? (int) $parameters['num_children'] - 1 : -1;

require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();

// Remobe any boards this user can't actually see.
$temp_boards = $boards;
$request = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE !($user_info[query_see_board])", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
unset($temp_boards[$row['ID_BOARD']]);
mysql_free_result($request);

echo '
<div style="padding-left:2px;">';

foreach ($cat_tree as $catid => $tree)
{
foreach ($boardList[$catid] as $boardid)
{
$prefix = '';
for ($i=0; $i<=$boards[$boardid]['level']; $i++)
$prefix .= '-';

echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a> (', $boards[$boardid]['posts'], ')</span><br />';
}
}

echo '
</div>';
Title: Re: double name in category block
Post by: iobit on April 29, 2011, 11:55:15 PM
guys are great, this code works fine thank you thank you and thank you again  :D :D
SimplePortal 2.3.8 © 2008-2024, SimplePortal