Request for "category" view

Started by Vedm, November 11, 2004, 08:02:50 PM

Previous topic - Next topic

Vedm

When I at the first time tried to navigate through the linktree, I thought that clicking on category (now, for example, it says "... | SMF Support | ...") opens a page with the category view - to show all boards and sub-boards it that category. But no, it doesn't. Instead of it, I am taken to the forum Index...

When there are many sub-boards in a few boards belonging to one category, and there are two or more different categories, it becomes very hard to navigate, to track and see all the latest posts in one particular category.

So why not make a category view, to display only:
- its boards with their info and last post links;
- their subboards with their info and last post links;
- 5 (or how much you'll select) latest 'ssi_recentTopics' or 'ssi_recentPosts' (selectable), applied to this particular category.

I've handycrafted an image to show you an example of what I mean: see attachment
(2 moderators: please attach it to this post it as it won't last long there - site is moving in a few days)

It would be also nice to allow applying of SMF themes to category view. So if you have a big community with different categories (from "website one", "site two" and so on), you would not only ease the pointing of users to their boards, but also give them the feeling of staying on their site by making similar forum-styles.

What do you think about it? Comments are highly appreciated.

Edit: Image attached - Oldiesmann
Etit2: Thank you! - Vedm
My Forum runs under SMF 1.0 RC1

Oldiesmann

Quote from: Vedm on November 11, 2004, 08:02:50 PM
When I at the first time tried to navigate through the linktree, I thought that clicking on category (now, for example, it says "... | SMF Support | ...") opens a page with the category view - to show all boards and sub-boards it that category. But no, it doesn't. Instead of it, I am taken to the forum Index...

When there are many sub-boards in a few boards belonging to one category, and there are two or more different categories, it becomes very hard to navigate, to track and see all the latest posts in one particular category.

So why not make a category view, to display only:
- its boards with their info and last post links;
- their subboards with their info and last post links;
- 5 (or how much you'll select) latest 'ssi_recentTopics' or 'ssi_recentPosts' (selectable), applied to this particular category.

I've handycrafted an image to show you an example of what I mean: here
(2 moderators: please attach it to this post it as it won't last long there - site is moving in a few days)

It would be also nice to allow applying of SMF themes to category view. So if you have a big community with different categories (from "website one", "site two" and so on), you would not only ease the pointing of users to their boards, but also give them the feeling of staying on their site by making similar forum-styles.

What do you think about it? Comments are highly appreciated.

I don't think it needs to show all the childboards like that - just a snapshot of the category as it looks on the board index without all the other categories and stuff. Otherwise it's a great idea.
Michael Eshom
Christian Metal Fans

OvermindDL1

It looks nice, but it looks like a theme mod to me....

Oldiesmann

This would require more than a theme mod. That's just an example of what it would be like.
Michael Eshom
Christian Metal Fans

Oldiesmann

Try this and see if it works:

Sources/BoardIndex.php

Find
// Find all boards and categories, as well as related information.
$result_boards = db_query("
SELECT
c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.description,
b.numPosts, b.numTopics, b.ID_PARENT,
IFNULL(mem.memberName, m.posterName) AS posterName, m.posterTime, m.subject, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName," . (!$user_info['is_guest'] ? "
(IFNULL(lb.logTime, 0) >= b.lastUpdated) AS isRead, c.canCollapse,
IFNULL(cc.ID_MEMBER, 0) AS isCollapsed" : ' 1 AS isRead') . ",
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,
IFNULL(mem2.ID_MEMBER, 0) AS ID_MODERATOR, mem2.realName AS modRealName
FROM {$db_prefix}categories AS c, {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}collapsed_categories AS cc ON (cc.ID_CAT = c.ID_CAT AND cc.ID_MEMBER = $ID_MEMBER)" : '') . "
LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = b.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = mods.ID_MEMBER)
WHERE $user_info[query_see_board]
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);


Replace
// Find all boards and categories, as well as related information.
$result_boards = db_query("
SELECT
c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.description,
b.numPosts, b.numTopics, b.ID_PARENT,
IFNULL(mem.memberName, m.posterName) AS posterName, m.posterTime, m.subject, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName," . (!$user_info['is_guest'] ? "
(IFNULL(lb.logTime, 0) >= b.lastUpdated) AS isRead, c.canCollapse,
IFNULL(cc.ID_MEMBER, 0) AS isCollapsed" : ' 1 AS isRead') . ",
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,
IFNULL(mem2.ID_MEMBER, 0) AS ID_MODERATOR, mem2.realName AS modRealName
FROM {$db_prefix}categories AS c, {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}collapsed_categories AS cc ON (cc.ID_CAT = c.ID_CAT AND cc.ID_MEMBER = $ID_MEMBER)" : '') . "
LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = b.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = mods.ID_MEMBER)
WHERE $user_info[query_see_board]
" . (isset($_REQUEST['cat']) ? " AND c.ID_CAT = $_REQUEST[id_cat]" : '') . "
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);


Find
// Haven't set this category yet.
if (empty($context['categories'][$row_board['ID_CAT']]))
{
$context['categories'][$row_board['ID_CAT']] = array(
'id' => $row_board['ID_CAT'],
'name' => $row_board['catName'],
'is_collapsed' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1 && $row_board['isCollapsed'] > 0,
'can_collapse' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1,
'collapse_href' => isset($row_board['canCollapse']) ? $scripturl . '?action=collapse;c=' . $row_board['ID_CAT'] . ';sa=' . ($row_board['isCollapsed'] > 0 ? 'expand' : 'collapse;') . '#' . $row_board['ID_CAT'] : '',
'collapse_image' => isset($row_board['canCollapse']) ? '<img src="' . $settings['images_url'] . '/' . ($row_board['isCollapsed'] > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' border="0" />' : '',
'href' => $scripturl . '#' . $row_board['ID_CAT'],
'boards' => array(),
'new' => false
);
$context['categories'][$row_board['ID_CAT']]['link'] = '<a name="' . $row_board['ID_CAT'] . '" href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
}


Replace
// Haven't set this category yet.
if (empty($context['categories'][$row_board['ID_CAT']]))
{
$context['categories'][$row_board['ID_CAT']] = array(
'id' => $row_board['ID_CAT'],
'name' => $row_board['catName'],
'is_collapsed' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1 && $row_board['isCollapsed'] > 0,
'can_collapse' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1,
'collapse_href' => isset($row_board['canCollapse']) ? $scripturl . '?action=collapse;c=' . $row_board['ID_CAT'] . ';sa=' . ($row_board['isCollapsed'] > 0 ? 'expand' : 'collapse;') . '#' . $row_board['ID_CAT'] : '',
'collapse_image' => isset($row_board['canCollapse']) ? '<img src="' . $settings['images_url'] . '/' . ($row_board['isCollapsed'] > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' border="0" />' : '',
'href' => $scripturl . '?cat=' . $row_board['ID_CAT'],
'boards' => array(),
'new' => false
);
$context['categories'][$row_board['ID_CAT']]['link'] = '<a href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
}


Themes/default/MessageIndex.template.php

Find
// Show the category name with a link to the category. (index.php#id)
echo '
<option value="" disabled="disabled">-----------------------------</option>
<option value="#', $category['id'], '">', $category['name'], '</option>
<option value="" disabled="disabled">-----------------------------</option>';


Replace
// Show the category name with a link to the category. (index.php#id)
echo '
<option value="" disabled="disabled">-----------------------------</option>
<option value="?cat=', $category['id'], '">', $category['name'], '</option>
<option value="" disabled="disabled">-----------------------------</option>';


That should work, but let me know if it doesn't.
Michael Eshom
Christian Metal Fans

Vedm

#5
2 Oldiesmann:
Thanks, glad you like this idea! But why do you think childboard descriptions and their last post info are exessive (sorry if it doesn't sound well, don't know exactly how to say "not neccesary but existing" in right words)?
I think they would become very useful for the most part of 'category view' users.

2 OvermindDL1:
I hope this deserves to become more then just a mod. ;)
My Forum runs under SMF 1.0 RC1

Oldiesmann

I don't really see any need for viewing child boards and their descriptions in the category view. Category view is meant to display the main boards within the category. You can click on a board title to see child boards and descriptions.
Michael Eshom
Christian Metal Fans

Vedm

Quote from: Oldiesmann on November 12, 2004, 06:28:12 PMCategory view is meant to display the main boards within the category. You can click on a board title to see child boards and descriptions.

Why click once more, if you can (in what I suggest) just take a look? :)
My Forum runs under SMF 1.0 RC1

Oldiesmann

Because otherwise you have a bunch of additional template work to do. It's a lot simpler to do it this way.

* Oldiesmann goes back to sprucing this up to turn it into a mod
Michael Eshom
Christian Metal Fans

David

I really like how SMF does it compared to vB.  In vB, it does what you suggest.  Show you just the boards in that one category.  I normally find myself doing this by accident, and then navigating back to the board index is harder.  Rather by using anchors on the boardindex so you see the category it keeps navigation simplified.
This space for rent.

Vedm

2 Oldiesmann:
Check this out:
http://eglador.info/forum/index.php?cat=2

I'm getting following errors:
QuoteNotice: Undefined index: id_cat in /opt/hosting/eglador.info/html/forum/Sources/BoardIndex.php on line 81
QuoteYou have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.ca
File: /opt/hosting/eglador.info/html/forum/Sources/BoardIndex.php
Row: 84
SMF version - 1.0 RC1, maybe that's what is causing the problem?

Quote from: Oldiesmann on November 12, 2004, 07:00:31 PMBecause otherwise you have a bunch of additional template work to do. It's a lot simpler to do it this way.
Maybe when it writes "Child Boards: list", just replace this with inserting table of childboards (from board index)? This should be simple in coding.
(example of what I mean)


2 David: it should't be harder to navigate to Index - you have linktree and "Home" button. Maybe you get confused in vB just because you got used to how it's in SMF?
My Forum runs under SMF 1.0 RC1

Oldiesmann

#11
Sorry about that. Find where it says $_REQUEST[id_cat] in Boardindex.php and change that to $_REQUEST[cat]

As for the childboard display - I guess that could be done, but the point is it's ugly and takes up a ton of space. What happens if you have 4 or 5 child boards someplace or a child board has child boards?
Michael Eshom
Christian Metal Fans

Vedm

Aw, nice, now it's working! Thank you very much.

Yes, Oldiesmann, you are right, this way of inserting subboards is uglier. If the first offered way is much harder to code - okay, let's stay without it.

So, in the manner you've done it, this view is still without 'ssi_recentPosts' applied to particular category, and it cannot be themed personally. Just a little modded Index page. For this grade of modding it would be easier to just autocollapse other categories by clicking on selected category. It is the way it's done in phpBB.
My Forum runs under SMF 1.0 RC1

Oldiesmann

Yes, it's just a modified index. Why does it have to be more than that? As far as recent posts goes:

Sources/Recent.php

Find
// Find all the posts.  Newer ones will have higher IDs.  (assuming the last 4 * number are accessable...)
$request = db_query("
SELECT
m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG,
IFNULL(mem.realName, m.posterName) AS posterName, t.ID_BOARD, b.name AS bName,
m.body, m.smileysEnabled
FROM {$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.ID_MSG >= " . ($modSettings['maxMsgID'] - 4 * $showlatestcount) . "
AND t.ID_TOPIC = m.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
AND $user_info[query_see_board]
ORDER BY m.ID_MSG DESC
LIMIT $showlatestcount", __FILE__, __LINE__);


Replace
// Find all the posts.  Newer ones will have higher IDs.  (assuming the last 4 * number are accessable...)
$request = db_query("
SELECT
m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG,
IFNULL(mem.realName, m.posterName) AS posterName, t.ID_BOARD, b.name AS bName,
m.body, m.smileysEnabled
FROM {$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.ID_MSG >= " . ($modSettings['maxMsgID'] - 4 * $showlatestcount) . "
AND t.ID_TOPIC = m.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
" . isset($_REQUEST['cat']) ? "AND b.ID_CAT = $_REQUEST[cat]" : '' . "
AND $user_info[query_see_board]
ORDER BY m.ID_MSG DESC
LIMIT $showlatestcount", __FILE__, __LINE__);


That will change the functionality of the "most recent posts" thing on the board index to only show the latest posts from a certain category if you're viewing a category.

Auto-collapsing - what's wrong with this method? It works just as well doesn't it?

Themeing - why do you need to be able to theme this particular section? It just displays the category the exact same way it does on the board index. I don't see any reason in making this more complicated than it needs to bee.
Michael Eshom
Christian Metal Fans

Vedm

#14
http://www.phpbb.com/phpBB/ - try clicking on categories' names. You'll see what it does. :)
That would also be the solution to the confusing of 'category view' accident users - what David mentioned above.

About 'themeing' the caterories: that's what I suggested in my first message:
Quote from: Vedm on November 11, 2004, 08:02:50 PMIt would be also nice to allow applying of SMF themes to category view. So if you have a big community with different categories (from "website one", "site two" and so on), you would not only ease the pointing of users to their boards, but also give them the feeling of staying on their site by making similar forum-styles.


When I apply your code for Recent.php, I get the following error:
QuoteNotice: Undefined index: cat in /opt/hosting/eglador.info/html/forum/Sources/Recent.php on line 98

That 'line 98' contains 13'th row from your code:
Quote" . isset($_REQUEST['cat']) ? "AND b.ID_CAT = $_REQUEST[cat]" : '' . "


Edit: added somewhat deeper explanations
My Forum runs under SMF 1.0 RC1

morph

" . isset($_REQUEST['cat']) ? "AND b.ID_CAT = $_REQUEST[cat]" : '' . "

Try changing that to:
" . isset($_REQUEST[cat]) ? "AND b.ID_CAT = $_REQUEST[cat]" : "" . "

Coming soon!

Vedm

Already tried that. Also produces errors:
QuoteNotice: Use of undefined constant cat - assumed 'cat' in /opt/hosting/eglador.info/html/forum/Sources/Recent.php on line 98

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND b.ID_CAT = 2' at line 1
File: /forum/Sources/Recent.php
Line: 101


2 Oldiesmann:
Please note I've added some explanations to my previous message here.
My Forum runs under SMF 1.0 RC1

Vedm

#17
Oldiesmann, looking at your code once again, I rememered how you've made it for Sources/BoardIndex.php
Compare " . isset($_REQUEST['cat']) ? "AND b.ID_CAT = $_REQUEST[cat]" : '' . "
with
" . (isset($_REQUEST['cat']) ? " AND b.ID_CAT = $_REQUEST[cat]" : '') . "
Second one works! :)

But look here - there are only two last messages, why?
And four in here...
How can I set the quantity of 'recent posts' to display?
My Forum runs under SMF 1.0 RC1

[Unknown]

Quote from: David on November 12, 2004, 07:57:45 PM
I really like how SMF does it compared to vB.  In vB, it does what you suggest.  Show you just the boards in that one category.  I normally find myself doing this by accident, and then navigating back to the board index is harder.  Rather by using anchors on the boardindex so you see the category it keeps navigation simplified.

Completely and totally agreed.  I have always hated this other method - for example, I might go "crawling" down the board index... how can I do this if clicking a category name (which I will often do to go to the next board down on the list, possibly in the next category) when it takes me to a mini-page?

Forgive me, but I would like to think I post and read a lot here.  And, by virtue of that, I have seen a lot of what makes navigation difficult and easy.  I really don't think your proposal would make navigation easier - except when you're so used to it happening that you expect it.  However, it really isn't the most LOGICAL way, it's just the most vBulletin/Invision/phpBB way.

It is an error in logical judgement to assume that just because everyone does it, it is the best way.  While this is often true, too many people take it as fact that "many doing stupid" leads to "stupid is best way".  This is another reason I don't like arguments that reference other software - it stands moot to me.  I'm saying this so you don't respond saying, "well they do it so it must be better navigation!"

The way of calculating recent posts is limited to only the most recent X posts.  This is logical anyway, because if they are old... they are not recent.  A week old post is not recent, is it?  You're just saying it is because you want 5 posts there - but that's again not the logical purpose of the feature.  Off my tangent, you'll have to increase that limit for your way to work properly.  But, this will make your forum slower, obviously.

-[Unknown]

Vedm

[Unknown], I must reveal the truth: SMF is the second forum system I'm administrating. :D First was YaBB SE. I wasn't used to using any kind of such software - never liked empty chatting. :)

It started in August - when friend of mine who owned an RPG forum asked me to look after it. And I had a plenty of free time and wanted to learn new... So I discovered YaBB SE project has stopped and SMF is stated as a replacement. For the person with lack of appropriate 'web' knowledge (I'm a systems engineer, projecting and building workstations & entry level servers is my bread for breakfast) I moved REALLY fast, in just one night - and I wish to thank you for that.

When the domain/forum owner phoned me and asked if we can merge the forum with another one, I started learning phpBB and also vB (the only system allowing merging of different forums into it).

And while I got myself confused with SMF linktree - since first window-based OS I got used to the Explorer kind of tree browsing (you click subfolder - you're transferred into it) - I looked at how everything is made in other systems. And found the phpBB way of browsing and switching categories interesting. Then I thought - if you combine applying of 'recent posts' to the category with phpBB 'collapse-other-categories' feature - it could be great for big boards.

Please forgive me if I'm wrong. There's an old saying: "Sometimes unsophisticated sight is more sharp" - maybe in this case it isn't. :-\
My Forum runs under SMF 1.0 RC1

Advertisement: