Hi there,
On the boardindex, I would like to reposition the sub-boards (children) and place it in the div "info" of a board instead of being a direct div of the board itself. Where would I have to look for that? So far, I've gone through boardindex.template.php and boardindex.php in Themes and Sources.
I do not see what SMF version you are using, below is for 2.1.2...
In BoardIndex.template.php
Remove this bit
// Won't somebody think of the children!
if (function_exists('template_bi_' . $board['type'] . '_children'))
call_user_func('template_bi_' . $board['type'] . '_children', $board);
else
template_bi_board_children($board);
and update this bit to below code
/* Each board in each category's boards has:
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
children (see below.), link_children (easier to use.), children_new (are they new?),
topics (# of), posts (# of), link, href, and last_post. (see below.) */
foreach ($category['boards'] as $board)
{
echo '
<div id="board_', $board['id'], '" class="up_contain ', (!empty($board['css_class']) ? $board['css_class'] : ''), '">
<div class="board_icon">
', function_exists('template_bi_' . $board['type'] . '_icon') ? call_user_func('template_bi_' . $board['type'] . '_icon', $board) : template_bi_board_icon($board), '
</div>
<div class="info">
', function_exists('template_bi_' . $board['type'] . '_info') ? call_user_func('template_bi_' . $board['type'] . '_info', $board) : template_bi_board_info($board), '
<br>
', function_exists('template_bi_' . $board['type'] . '_children') ? call_user_func('template_bi_' . $board['type'] . '_children', $board) : template_bi_board_children($board), '
</div><!-- .info -->';
Thanks!
I did it this way:
foreach ($category['boards'] as $board)
{
echo '
<div id="board_', $board['id'], '" class="up_contain', (!empty($board['css_class']) ? $board['css_class'] : ''), '">
<div class="board_icon">
', function_exists('template_bi_' . $board['type'] . '_icon') ? call_user_func('template_bi_' . $board['type'] . '_icon', $board) : template_bi_board_icon($board), '
</div>
<div class="info">
', function_exists('template_bi_' . $board['type'] . '_info') ? call_user_func('template_bi_' . $board['type'] . '_info', $board) : template_bi_board_info($board), '
';
// Won't somebody think of the children!
/*Changed: moved subboards from before #board_[id]*/
if (function_exists('template_bi_' . $board['type'] . '_children'))
call_user_func('template_bi_' . $board['type'] . '_children', $board);
else
template_bi_board_children($board);
echo ' </div><!-- .info -->';
I thought keeping the if condition was important? Is there any difference in your suggestion and my approach?
My code also held the if condition, in the form of the conditional function exists ?
The functional result is the exact same, but the conditional is more compact in code...
as a matter of fact, it would be cleaner if the SMF code would be more consistent: as you can see both syntaxes are used in the same file...
Ternaries are good for really simple if/else situations. As soon as you get into needing arrays, or strings of conditions, doing it with brackets is much more comprehensible. IOW, sometimes being "inconsistent" makes for better results. Horses for courses. :)