SimplePortal

Customization => Custom Coding => Topic started by: james-at on April 11, 2011, 08:19:42 AM

Title: How to get Board Index in php block
Post by: james-at on April 11, 2011, 08:19:42 AM
I need get it block with php code

(http://i53.tinypic.com/2mxlxfb.jpg)
xample from: http://foro.red-g.net (http://foro.red-g.net)

Thanks o.o
Title: Re: PHP block code to get this
Post by: AngelinaBelle on April 11, 2011, 01:39:42 PM
You want just a list of links?
Title: Re: PHP block code to get this
Post by: james-at on April 11, 2011, 02:00:51 PM
You want just a list of links?

Yes, A code for Showautomaticly the Links of the all Categories and all Forums, Its obviously, regards
Title: Re: How to get Board Index in php block
Post by: AngelinaBelle on April 11, 2011, 04:06:46 PM
I would start with a call to getBoardIndex. (you can see how it is called   in BoardIndex.php).


Then, I would look at template.BoardIndex.php to see how that information is written out with echo.
You want a very abbreviated format, of course, so you would copy that and then take a lot away from it.


This is definitely a little custom coding project.
Title: Re: How to get Board Index in php block
Post by: james-at on April 11, 2011, 06:37:04 PM
Quote
I would start with a call to getBoardIndex [...]


getBoardIndex call? : '(

I am newbie in php. could explain it better?

PS: There was a mod that supposedly made ​​all it easier (SP Navigation Block http://simpleportal.net/index.php?topic=1532.0) But was created for an older version of SimplePortal. Could you help me adapt it to this new version, and thus be useful for the community?

Regards [-:
Title: Re: How to get Board Index in php block
Post by: james-at on April 12, 2011, 04:31:28 PM
Thanks for ignore me  :(
Title: Re: How to get Board Index in php block
Post by: AngelinaBelle on April 12, 2011, 04:41:12 PM
As there is no money for a 24/7 support staff, we are a spread a bit thin at SimplePortal.net.
What you have is a custom coding project, rather than a SimplePortal support issue.
My first advice is to read about php, HTML, and CSS at someplace like w3schools.com.
I would like your request to attract the attention of someone who has done this kind of custom coding before.
I think the most sensible thing to do is to move it to a custom coding board.
What do you think?
Title: Re: How to get Board Index in php block
Post by: james-at on April 18, 2011, 09:54:29 AM
I would like your request to attract the attention of someone who has done this kind of custom coding before.
I think the most sensible thing to do is to move it to a custom coding board.
What do you think?

You're right. Should approach the person who has worked on this code before.





Well, I just resolved the issue myself.  8)
I made a small modification to the original code.


SP Navigation Block for SimplePortal 2.3.3 (Modified by jAmsx)

1. Go to Add block > Custom Php Code >
2. Paste the next code:

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)
{
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></span><br />';
}
}

echo '
</div>';

This work pefectly. Check my portal: http://www.darksitel.com/index.php

Regards.
Title: Re: How to get Board Index in php block
Post by: Aw06 on July 24, 2011, 09:55:30 AM
How can i do this so it does not show the child boards ?
Title: Re: How to get Board Index in php block
Post by: iobit on February 08, 2013, 06:00:48 AM
I would like your request to attract the attention of someone who has done this kind of custom coding before.
I think the most sensible thing to do is to move it to a custom coding board.
What do you think?

You're right. Should approach the person who has worked on this code before.





Well, I just resolved the issue myself.  8)
I made a small modification to the original code.


SP Navigation Block for SimplePortal 2.3.3 (Modified by jAmsx)

1. Go to Add block > Custom Php Code >
2. Paste the next code:

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)
{
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></span><br />';
}
}

echo '
</div>';

This work pefectly. Check my portal: http://www.darksitel.com/index.php

Regards.

Dont works with version 2.3.5 :(
Title: Re: How to get Board Index in php block
Post by: iobit on February 10, 2013, 01:51:19 PM
Can anyone update this to version 2.3.5'

Thanks.
SimplePortal 2.3.8 © 2008-2024, SimplePortal