SimplePortal
Customization => Blocks and Modifications => Block Requests => Topic started by: iobit on April 24, 2011, 02:51:18 AM
-
Hello,
can you create a block for show category forum (like music, game...)in portal?
thanks.
PS: great work simplyportal ;D
-
http://simpleportal.net/index.php?topic=8653.msg46252#msg46252
I did not try it. But you can try and put the result here.
-
Thanks fantastic!! 8),
is there a way to see the number of posts in each category?
thanks again
-
Try this:
', $boards[$boardid]['name'], '</a>
', $boards[$boardid]['name'], '</a> (', $boards[$boardid]['count_posts'], ')
-
I view all numbers 1
name category 1
name category 1
name category 1
name category 1
-
Sorry, we need to do more operations.
foreach ($boardList[$catid] as $boardid)
{
foreach ($boardList[$catid] as $boardid)
{
// Sorry this is hard method for server. But easy. :)
$request = db_query("
SELECT numPosts
FROM {$db_prefix}boards
WHERE ID_BOARD = $boardid", __FILE__, __LINE__);
list ($num_posts) = mysql_fetch_row($request);
mysql_free_result($request);
', $boards[$boardid]['name'], '</a>
', $boards[$boardid]['name'], '</a> (', $num_posts, ')
-
Try this:
', $boards[$boardid]['name'], '</a>
', $boards[$boardid]['name'], '</a> (', $boards[$boardid]['count_posts'], ')
Change 'count_posts' as 'posts' and it should work.
-
Sorry, we need to do more operations.
foreach ($boardList[$catid] as $boardid)
{
foreach ($boardList[$catid] as $boardid)
{
// Sorry this is hard method for server. But easy. :)
$request = db_query("
SELECT numPosts
FROM {$db_prefix}boards
WHERE ID_BOARD = $boardid", __FILE__, __LINE__);
list ($num_posts) = mysql_fetch_row($request);
mysql_free_result($request);
', $boards[$boardid]['name'], '</a>
', $boards[$boardid]['name'], '</a> (', $num_posts, ')
work but i have this: Read Before Posting (1) ()
-
Try this:
', $boards[$boardid]['name'], '</a>
', $boards[$boardid]['name'], '</a> (', $boards[$boardid]['count_posts'], ')
Change 'count_posts' as 'posts' and it should work.
instead, this: Read Before Posting ()
-
instead, this: Read Before Posting ()
Sorry. I thought you were using SMF 2.0 versions. For 1.1 versions, you need this extra edit:
Sources/Subs-Boards.php
b.countPosts,
b.countPosts, b.numPosts,
'count_posts' => empty($row['countPosts']),
'count_posts' => empty($row['countPosts']),
'posts' => $row['numPosts'],
-
now have this: Read Before Posting (1) (1)
-
Can you paste here what you have now? (the whole code)
-
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)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
foreach ($boardList[$catid] as $boardid)
{
// Sorry this is hard method for server. But easy. :)
$request = db_query("
SELECT numPosts
FROM {$db_prefix}boards
WHERE ID_BOARD = $boardid", __FILE__, __LINE__);
list ($num_posts) = mysql_fetch_row($request);
mysql_free_result($request);
$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> (', $num_posts, ') (', $boards[$boardid]['posts'], ')</span><br />';
}
}
echo '
</div>';
-
Use this one:
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)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
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>';
-
are you fantastic :D work very fine :D thanks thanks thanks
-
You're welcome. ;)
-
This code gives error "Fatal error: Call to undefined function db_query()" with SMF 2.0.2 and SP 2.3.5
Can't figure how to fix it...
-
Same "Fatal Error"
-
Hello,
please can anyone update this code for version 2.3.5?
Thanks.
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)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
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>';