Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Argon3000 on December 24, 2013, 08:23:49 AM

Title: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: Argon3000 on December 24, 2013, 08:23:49 AM
Hi,

Please can someone tell me. How to Remove Parent Board (ID)?


Themes/theme_name/BoardIndex.template.php

(http://i069.radikal.ru/1312/5d/dd1737573b7a.png)
Title: Re: How to Remove Parent Board (ID)?
Post by: kat on December 24, 2013, 08:45:22 AM
(http://www.katzy.dsl.pipex.com/SMF/welcome.gif)

Sorry, Argon. I'm not, entirely, sure what you mean by "Parent board (ID)".

The part you've crossed-out seems to be an actual board So, I'm a little confused. :(
Title: Re: How to Remove Parent Board (ID)?
Post by: Argon3000 on December 24, 2013, 08:55:34 AM
Sorry, K@.

Remove Board.
Title: Re: How to Remove Parent Board (ID)?
Post by: kat on December 24, 2013, 09:01:07 AM
So, have I got this right? You want to see the categories, but none of the boards?

I must have that wrong, surely?

In the bar, with the category name, you'll see a "-" sign, on the far right. If you click that, it'll collapse the boards, in that category, so that you can't see them.

Is that what you want to see?
Title: Re: How to Remove Parent Board (ID)?
Post by: Argon3000 on December 24, 2013, 09:06:23 AM
No.

Remove certain board (known ID of the board) in the file Themes/theme_name/BoardIndex.template.php

Title: Re: How to Remove Parent Board (ID)?
Post by: Sorck on December 24, 2013, 09:12:34 AM
So you want to hide it on the board index so you can't see it on that list, but you still want the board to exist?

In BoardIndex.template.php you'll have the following two lines (or something similar):
foreach ($category['boards'] as $board)
{

You could add the following on the line after the above code:

if ($board['id'] === 1337)
continue;

Replacing 1337 with your board ID. This means that the board in question shouldn't display on your board index anymore, but will still exist (so it will appear in unread posts and the likes).



However, if you want to delete the board entirely, go to Admin -> Forum -> Boards and you can modify/delete your board through there.
Title: Re: How to Remove Parent Board (ID)?
Post by: Argon3000 on December 24, 2013, 10:42:28 AM
OK! Thank you! It works!  :)
Title: Re: How to Remove Parent Board (ID)?
Post by: Argon3000 on December 24, 2013, 10:48:19 AM
(http://s020.radikal.ru/i705/1312/39/71960d6b9ce5.png)

Remove certain category (known ID of the category) in the file Themes/theme_name/BoardIndex.template.php
$category['id']   ?
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: Sorck on December 24, 2013, 11:19:52 AM
You'll need to move up a loop for that.

It'll look something like
foreach ($context['categories'] as $category)
{

And then after that you can put:
if ($category['id'] === 1337)
continue;
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: Argon3000 on December 24, 2013, 11:40:52 AM
Removed all the boards in this category.
How to Removed a category, but the boards were on the page?
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: Sorck on December 24, 2013, 11:49:28 AM
You want to remove only the bit which says what the category is called?

You need to find the bit which output that and wrap it with if($category['id'] !== 1337) {
// existing code here
}


In the default theme the "existing code" would be:
echo '
<tbody class="header" id="category_', $category['id'], '">
<tr>
<td colspan="4">
<div class="cat_bar">
<h3 class="catbg">';

// If this category even can collapse, show a link to collapse it.
if ($category['can_collapse'])
echo '
<a class="collapse" href="', $category['collapse_href'], '">', $category['collapse_image'], '</a>';

if (!$context['user']['is_guest'] && !empty($category['show_unread']))
echo '
<a class="unreadlink" href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>';

echo '
', $category['link'], '
</h3>
</div>
</td>
</tr>
</tbody>';
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: margarett on December 24, 2013, 01:03:03 PM
Why don't you just move those boards to another category? It makes no sense to have boards under no category, methinks...
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: kat on December 24, 2013, 02:20:59 PM
I find the whole concept of what's going on, here, a bit worrying, to be honest.
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: Sorck on December 24, 2013, 03:06:32 PM
Thinking about why this could be useful has reminded me of a trick which does the 'hidden' board thing within SMF. If you create a board that nobody can view, you can then put a child board which people have permissions to view. They can then see the board through unread messages or directly but not through the board index.

Though I do agree that obscuring a board is an odd thing to do in general.

Quote from: margarett on December 24, 2013, 01:03:03 PM
Why don't you just move those boards to another category? It makes no sense to have boards under no category, methinks...
It looks like it'll break the layout a bit within the category header. Well, it'll still render but won't look quite right.
Title: Re: How to Remove Board and Category (ID) in BoardIndex.template.php?
Post by: Argon3000 on December 25, 2013, 07:55:02 AM
Quote from: Sorck on December 24, 2013, 11:49:28 AM
...

Thank you! It works!  :)