TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 466
  • Total: 467
  • @rjen

[Block] Board Index Menu

Started by IchBin, August 23, 2007, 02:31:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alving

Quote from: IchBinâ,,¢ on June 20, 2008, 02:55:45 AM
Fixed the code in the post above, and fixed the code on your site. Sorry about that. Don't know why I left some things out.
cheers, ichbin!  i just saw it now when i visited my site!   thanks once again

Balaban

wow , great .
thnx IchBinâ„¢

agent47

IchBin I just copied and pasted this code onto a PHP block but it just doesn't seem to appear... It's basically empty. Please help me out here buddy.... Thanks alot....

IchBin

It would probably help if you followed our Posting Guidelines so I knew what versions of software you were running.

--edit--

I see you've sent me a PM. I don't do support via PM, sorry. However, I see that you are now running SMF2. That would be the reason this doens't work. It was written for SMF1.x. I don't know if I'll have the time real soon to update this, but I'll see what I can do.

agent47

My apologies for PM'ing. Thanks for responding anyways. Will be looking forward to see u write one for SMF 2+

IchBin

#65
Well I was worried that SMF might have changed the code for the jump_to function of SMF that this relies on. Looks like it only need a slight update for database stuff. This should work in SMF2.
global $smcFunc, $context;

// Find the boards/cateogories they can see.
$request = $smcFunc['db_query']('', '
SELECT c.name AS catName, c.id_cat, b.id_board, b.name AS boardName, b.num_topics, b.child_level
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE {query_see_board}',
array()
);

$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = $smcFunc['db_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['child_level'],
'is_current' => isset($context['current_board']) && $row['id_board'] == $context['current_board'],
'topics' => $row['num_topics']
);
}
$smcFunc['db_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'],' Topics</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 />';
}
         
}
}

agent47

Wow thanks alot man. You will never know how much I appreciate it - TRUST ME. ALOT! :)

agent47

Just a suggestion. The Board names should be click-able links that can be collapsed and expanded would be a pretty cool. Only a thought.

MBry0

Hi! the last code posted by IchBin doesn't work for me.

Link to my site: http://www.gamesandgamers.org
SMF version: 2.0.2
TP version: 1.106
Default Forum Language: Italian-utf8
Theme name and version: TotalBlue
Browser Name and Version: Latest version of Chrome, FF and IE
Mods installed:
Pretty URLs    1.0
SMF Arcade    2.5
Justify BBCode    2.3.2
Custom Board Sort 1.0.2
Float BBCODE 1.0.2
Highslide BBCode and Image Viewer 1.0
Drafts 1.1.2
Sitemap 2.2.0
Spoiler Tag 0.7.2a
Tapatalk SMF 2.0 RC4/RC5/Final Plugin 3.0.0
Aeva Media 1.4w

Related Error messages: Fatal error: Call to undefined function tpdb_query() in /web/htdocs/www.gamesandgamers.org/home/forum/Sources/Load.php(2176) : eval()'d code(114) : eval()'d code on line 4

IchBin

Try the code again, I updated the post above.

This website is proudly hosted on Crocweb Cloud Website Hosting.