News: Welcome to the TinyPortal Support site.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 16, 2019, 10:39:48 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3756
  • Latest: Ocean
Stats
  • Total Posts: 189087
  • Total Topics: 20763
  • Online Today: 58
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 48
Total: 48

Author Topic: forum in a center block  (Read 7737 times)

0 Members and 1 Guest are viewing this topic.

Tron420

  • Guest
forum in a center block
« on: June 21, 2007, 06:32:55 AM »
anyone know how i could put the forum board index in a center block?

Offline Zetan

  • Friends
  • *
  • Posts: 3471
Re: forum in a center block
« Reply #1 on: June 21, 2007, 12:02:09 PM »
Why would you want to?

Reality12

  • Guest
Re: forum in a center block
« Reply #2 on: June 21, 2007, 12:05:49 PM »
LOL. Didn't mean to laugh, but that response caught me off guard there zetan! :D

Offline Zetan

  • Friends
  • *
  • Posts: 3471
Re: forum in a center block
« Reply #3 on: June 21, 2007, 12:09:36 PM »
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

  • Guest
Re: forum in a center block
« Reply #4 on: June 21, 2007, 01:51:14 PM »
I understand exactly what you mean. :D

OP?? Was there a reason? Just curious.

Tron420

  • Guest
Re: forum in a center block
« Reply #5 on: June 21, 2007, 06:08:36 PM »
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

  • Guest
Re: forum in a center block
« Reply #6 on: June 21, 2007, 06:16:16 PM »
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:

Code: [Select]
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

  • Guest
Re: forum in a center block
« Reply #7 on: June 21, 2007, 06:27:18 PM »
Oh,

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

www.ufodbase.com

Tron420

  • Guest
Re: forum in a center block
« Reply #8 on: June 21, 2007, 06:52:58 PM »
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
« Last Edit: June 21, 2007, 07:16:46 PM by Tron420 »

vanguard

  • Guest
Re: forum in a center block
« Reply #9 on: June 21, 2007, 07:51:24 PM »
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.