Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: shadav on June 30, 2020, 03:57:08 AM

Title: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: shadav on June 30, 2020, 03:57:08 AM
nothing really special here....
just me playing around, moving stuff around

(https://www.simplemachines.org/community/index.php?action=dlattach;topic=573954.0;attach=269744;image)

in BoardIndex.template.php
find
echo '

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

replace
echo '

<p>', $board['description'] , '</p>
<p>', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], ' / ', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], '</p>';


find
// 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>

replace
echo '
</td>

SAVE

(https://www.simplemachines.org/community/index.php?action=dlattach;topic=573954.0;attach=269746;image)
in MessageIndex.template.php
find
</th>
<th scope="col" width="14%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>


replace
- <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>

find
</td>
<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>
<td class="lastpost ', $alternate_class, '">

replace
</td>
<td class="lastpost ', $alternate_class, '">


find
echo '
<p>', $txt['started_by'], ' ', $topic['first_post']['member']['link'], '
<small id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</small>
</p>

replace
echo '
<p>', $txt['started_by'], ' ', $topic['first_post']['member']['link'], '
<small id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</small>
<br />', $topic['replies'], ' ', $txt['replies'], ' / ', $topic['views'], ' ', $txt['views'], '
</p>

SAVE
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: shadav on July 01, 2020, 04:28:54 PM
I forgot about the recent posts
(https://www.simplemachines.org/community/index.php?action=dlattach;topic=573954.0;attach=269780;image)

Recent.template.php

find
<th scope="col">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>
<th scope="col" width="14%" align="center" class="hidden">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>';


replace
<th scope="col" align="left">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> - <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>';


find and remove
<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>


find
<p>
', $txt['started_by'], ' <strong>', $topic['first_post']['member']['link'], '</strong>
', $txt['in'], ' <em>', $topic['board']['link'], '</em>
<small id="pages', $topic['first_post']['id'], '">', $topic['pages'], '</small>
</p>

replace
<p>
', $txt['started_by'], ' <strong>', $topic['first_post']['member']['link'], '</strong>
', $txt['in'], ' <em>', $topic['board']['link'], '</em>
<small id="pages', $topic['first_post']['id'], '">', $topic['pages'], '</small>
<br />', $topic['replies'], ' ', $txt['replies'], ' / ', $topic['views'], ' ', $txt['views'], '
</p>
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Arantor on July 01, 2020, 04:34:52 PM
Not a fan of this, sorry, it makes it very cluttered on the left, not to mention making it harder for accessibility tools (i.e. non-sighted people) to use.

Might be better with a bit more spacing added in the CSS.
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Deaks on July 01, 2020, 05:31:30 PM
I've done this before for some themes years ago did try it recently but got validation errors so never released it.  I am a fan of this style,  however only think I have qualms with is the space it leaves
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Mick. on July 01, 2020, 05:37:25 PM
On a custom theme, say, at 900px wide, might do. I too can't stand the open space. It's a waste.

You should dabble on custom themes. I think you have the potential.

ps....i chopped and diced my boardindex a few months ago. https://www.idesignsmf.com/index.php?action=forum Tho, I don't have a direct link to the forum in my website since I want to preserve the 'blog' look.
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Antechinus on July 01, 2020, 05:39:59 PM
Quote from: Deaks on July 01, 2020, 05:31:30 PM
I've done this before for some themes years ago did try it recently but got validation errors so never released it.  I am a fan of this style,  however only think I have qualms with is the space it leaves

If you got validation errors that just means you didn't check the markup. You can do this sort of thing without validation problems as long as you check all your bits and pieces. :)
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Antechinus on July 01, 2020, 05:40:48 PM
Your first replace for MessageIndex.template.php is borked. :)

- <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>

You forgot the opening th tag. It has to be there somewhere.

Ranty also has a point about accessibility. The whole idea of scope="col" is that it allows screen readers to assign column headings to column content. Although arguably this is a moot point to some extent, since the default column content (particularly for the subject cells) isn't strictly tabular anyway.




Note to team: Really, it would make a lot of sense to not limit edit times in certain boards. This is a perfect example. The team has approved the topic, without checking for errors in the coding, and now Shadav is stuck with the OP as originally posted.

If you're not going to allow people to edit code they have posted (in any board, for that matter) then you should check it thoroughly for all possible errors before approving the topic. If you are not going to do that, then you should allow people to edit their posts. The current arrangement is the worst of both worlds.

(This is intended as constructive criticism, BTW.)
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Kindred on July 01, 2020, 06:18:07 PM
the edit time limit can not be set "per board"


I agree with Arantor. Not a fan of this one at all...   it takes a tabular data with clear columns (and meaning for the columns) and jams it up under other text...

I think a better/cleaner look would be to get rid of the first and last column... (the last (aka lastpost) column can even be hidden purely with CSS)
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: shadav on July 01, 2020, 06:27:36 PM
I merged the two th's together ;) since I got rid of that column

I thought about just getting rid of it entirely, but then you lose the sort by replies and views function
so instead I just tacked it onto the subject / started by


and yes I really wish that I could at least edit the first post without a time limit because well lol I make mistakes often and typos :D

I hadn't thought about screen readers.....

and yeah there's a lot of wide open space now  :laugh:

maybe in index.css
add some spacing to the text
find
table.table_list p
{
padding: 0;
margin: 0;
}


replace
table.table_list p
{
padding: 0;
margin: 5px 0px 5px 0px;
}

find
.topic_table td.subject p, .topic_table td.stats
{
font-size: 0.85em;
padding: 0;
margin: 0;
}

replace
.topic_table td.subject p, .topic_table td.stats
{
font-size: 0.85em;
padding: 0;
margin: 5px 0px 5px 0px;
}



and then
add more room to the latest post column
find
table.table_list tbody.content td.lastpost
{
line-height: 1.3em;
font-size: 85%;
width: 24%;
}


replace
table.table_list tbody.content td.lastpost
{
line-height: 1.3em;
font-size: 85%;
width: 35%;
}

find
.topic_table td.lastpost
{
font-size: 0.85em;
line-height: 1.3em;
padding: 4px;
}

replace
.topic_table td.lastpost
{
font-size: 0.85em;
line-height: 1.3em;
padding: 4px;
width: 35%;
}


hm....gonna play some more....
don't like the wide space there but don't really like the replies/view column either....
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Antechinus on July 01, 2020, 06:34:30 PM
Quote from: Kindred on July 01, 2020, 06:18:07 PM
the edit time limit can not be set "per board"
Quote from: Antechinus on July 01, 2020, 05:40:48 PMIf you're not going to allow people to edit code they have posted (in any board, for that matter) then you should check it thoroughly for all possible errors before approving the topic.
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Mick. on July 01, 2020, 06:42:02 PM
Im not a fan of them board icons either. Rid! lol
Title: Re: Moving the Topics/Posts/Replies/Views to under the Board/Post Name
Post by: Deaks on July 01, 2020, 06:50:29 PM
Quote from: Antechinus on July 01, 2020, 05:39:59 PM

If you got validation errors that just means you didn't check the markup. You can do this sort of thing without validation problems as long as you check all your bits and pieces. :)

I did also had someone else look at it, I released the theme without the changes did plan on updating with the changes when I fixed it but never got back to it, the n eventually just got rid of my themes.