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

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 09:13:15 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 97
  • Total: 97

forum in a center block

Started by Tron420, June 21, 2007, 01:32:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tron420

anyone know how i could put the forum board index in a center block?

Zetan


Reality12

LOL. Didn't mean to laugh, but that response caught me off guard there zetan! :D

Zetan

Well, I guess there is a reason.. I just find some requests odd at times.

Don't want a front page, set the front page to go straight to forums and still have blocks showing.
Recent topics I can understand, and there are snippits that can do this. Have the whole forum index in a block.... ?

Reality12

I understand exactly what you mean. :D

OP?? Was there a reason? Just curious.

Tron420

omg..

welll if u must know. I'm using a theme that has blocks that cant be disabled and if i could put the forum in a block i can arrange my site the way i want it

vanguard

I got this somewhere on these forums but for the sake of time I will just put a copy here. This has a simple text based output but works like a champion. Not sure how it would look in a center block but not much to lose by trying.

If you wanted to get fancy you could grab the code from your forum front page, like I did, and copy the code into an html block for the front page. Problem with this option is if you add or remove categories you'll have to copy the new code in again.

Here you go:

global $db_prefix, $context, $user_info, $scripturl;

if (!isset($context['jump_to']))
{
// 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.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' => -1);
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']
);
}
mysql_free_result($request);
}

foreach ($context['jump_to'] as $category)
{
echo '<span class="smalltext" style="text-decoration: underline; font-weight: bold;">', $category['name'], '<br /></span>';
foreach ($category['boards'] as $board)
echo '<span class="smalltext"><a href="' . $scripturl . '?board=' . $board['id'] . '.0">'. str_repeat('-', $board['child_level'] + 1) . $board['name'] . '</a><br /></span>';
}

vanguard

Oh,

Example of working block on my page in right block column:

www.ufodbase.com

Tron420

#8
that code isnt working for me

ive even tried it in html/bbc -  php block-  etc and get this error -

Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/content/h/i/t/hitthosting/html/cz/Sources/Load.php(1733) : eval()'d code(35) : eval()'d code on line 6

vanguard

Double checking:

Ok on my site the code is right and the block type is PHPBox. Make sure you click the source button before pasting code.

:)

If that doesn't work pehaps there is a difference in tp or smf versions or something different with your theme.

I hope you can make it work.

MYBESTHOMESnet