News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to hide child boards within parent board (when being inside parent board)

Started by Felix J, May 12, 2011, 09:43:01 PM

Previous topic - Next topic

Felix J

Ok, I did a search this time and found this - www.simplemachines.org/community/index.php?topic=294918.0

However it didn't solve my problem and I thought it would be better to make a new topic in correct board, it was also marked solved...

I would like to also do the child board links at board index page to non links.

Thanks

Felix J

Ohh damn, posted in wrong category I guess... Should be in that coding discussion board... Sorry I am tired now. I need to sleep.

Matthew K.

If I understand you correctly, you don't want Childboards to appear in their parent board? This is a setting in the Admin panel...

Felix J

Quote from: Labradoodle-360 on May 13, 2011, 01:42:42 AM
If I understand you correctly, you don't want Childboards to appear in their parent board? This is a setting in the Admin panel...

Are you talking about board permission?

Matthew K.

No, there is a setting in the Admin panel that allows you to not show child boards in their parent board.

Felix J

Quote from: Labradoodle-360 on May 13, 2011, 01:51:27 AM
No, there is a setting in the Admin panel that allows you to not show child boards in their parent board.

Maybe I am dumb or something, but I can't find it  :-\

Can you tell me where to find this feature within admin panel?

I have been looking through admin panel now numorous of times without finding it...  :(

Felix J

Please someone tell me. I really want to hide all child boards within their parent boards.

Felix J

Illori, perhaps you can help me? You seems to have great knowledge of the admin panel :)


Illori

as far as i know there is no "option" to do this and would require code changes.

Felix J

Quote from: Illori on May 13, 2011, 07:00:45 AM
as far as i know there is no "option" to do this and would require code changes.

I see.

Ok, I guess then I would need to remove some code within MessageIndex.template.php file? The question is then what to remove?

Illori

i am not sure what the code would be, and my coding skills are not up to par on taking on that task right now.

MrGrumpy

Is what you are trying to achieve is to have the links for the childboards shown on the boardindex but if you click the parent board for thos child links you don't see the childboards displayed so that they are only accessable via the links on the boardindex?
the possession of knowledge is worthless unless imparted upon others
My Custom Themes
2.0 themes only - I don't do 1.1.x

Felix J

Quote from: MrGrumpy on May 13, 2011, 07:30:11 AM
Is what you are trying to achieve is to have the links for the childboards shown on the boardindex but if you click the parent board for thos child links you don't see the childboards displayed so that they are only accessable via the links on the boardindex?

What I am trying to do is to first remove all child boards which you see after clicking on a parent board. This is however not all. I would also like to make the child board links on board index to just text (non clickable).

MrGrumpy

Sorry i don't really understand why you want to make the childboards not visible inside the parent board and also make the links non-clickable as you won't be able to access the childboards which in that case why have any childboards in the first place
the possession of knowledge is worthless unless imparted upon others
My Custom Themes
2.0 themes only - I don't do 1.1.x

Felix J

Quote from: MrGrumpy on May 13, 2011, 07:38:20 AM
Sorry i don't really understand why you want to make the childboards not visible inside the parent board and also make the links non-clickable as you won't be able to access the childboards which in that case why have any childboards in the first place

I want to do this just to 'tell' by text what a certain board involves for other 'sub-areas' of information. To make it more clear what a certain board involves and not. I don't want child boards but I want to have the "child board" or better in this case to say sub-area names below each parent board but just not as links.

MrGrumpy

If i'm understanding you right I believe you need to edit the code posted below - I can't test this as I'm on my laptop and not my PC but to remove the childboards from showing inside the parentboard remove the following code from MessageIndex.template.php


if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
{
echo '
<div class="tborder childboards" id="board_', $context['current_board'], '_childboards">
<div class="cat_bar">
<h3 class="catbg">', $txt['parent_boards'], '</h3>
</div>
<div class="table_frame">
<table class="table_list">
<tbody id="board_', $context['current_board'], '_children" class="content">';

foreach ($context['boards'] as $board)
{
echo '
<tr id="board_', $board['id'], '" class="windowbg2">
<td class="icon windowbg"', !empty($board['children']) ? ' rowspan="2"' : '', '>
<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';

// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';

echo '
</a>
</td>
<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';

// Has it outstanding posts for approval?
if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
echo '
<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';

echo '

<p>', $board['description'] , '</p>';

// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['moderators']))
echo '
<p class="moderators">', count($board['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';

// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="stats windowbg">
<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
</p>
</td>
<td class="lastpost">';

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

echo '
</td>
</tr>';

// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
if (!empty($board['children']))
{
// Sort the links into an array with new boards bold so it can be imploded.
$children = array();
/* Each child in each board's children has:
id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
foreach ($board['children'] as $child)
{
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" />' : '') . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';

$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
}
echo '
<tr id="board_', $board['id'], '_children"><td colspan="3" class="children windowbg"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td></tr>';
}
}
echo '
</tbody>
</table>
</div>
</div>';
}


As for the links, again I can't do no testing so can't give you an exact answer but can point you in the right direction.

in BoardIndex.template.php look at these lines - inparticular look at the lines starting with $child['link']


/* Each child in each board's children has:
id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
foreach ($board['children'] as $child)
{
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" />' : '') . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';

$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
}



Sorry i can't be more precise but my laptop doesn't have my test software on it.
the possession of knowledge is worthless unless imparted upon others
My Custom Themes
2.0 themes only - I don't do 1.1.x

Felix J

One thing more.. lets say I remove that code and wanted to make new subareas, then I would need to do it directly in the code or would it somehow work from the admin panel?

and then I mean just creating sub-area names below each parent board but not as links.

Hmm maybe it's not a so good idea anyway.  :-\


After a second thought given all the required changes I think I will have to live with having sub boards within each parent board just as redirecting boards...

But thanks anyway! Without your help I guess I wouldn't realize this...

Advertisement: