Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Now Available => Topic started by: RicochetPeter on January 14, 2005, 06:26:12 AM

Title: Displaying only one Category
Post by: RicochetPeter on January 14, 2005, 06:26:12 AM
Please Note this has been converted into a similar mod:
Mod: View Single Category (http://custom.simplemachines.org/mods/index.php?mod=486)

Original Post as follows

Hi all,

first of all I'd like to thank the developers for their fantastic work, this is really a superb forum software :)

My question: is there a way to display only one category of a forum, and I don't mean the others collapsed or sp, but really only that category and its subforums?


How to do it:
Check reply#8 or a better one in reply#14
Title: Re: Displaying only one Category
Post by: A.M.A on January 14, 2005, 06:53:38 AM
Through permission you can disable viewing some boards for guests or member groups .. if that what you meant!
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 14, 2005, 07:51:57 AM
Hmmm, no, that's not what I meant. Sorry if I have to draw the comparison: IPB looks like this when clicking on a category:
http://www.hydrogenaudio.org/forums/index.php?showforum=64
All you see is that very section of the forum and the forums in there, nothing else... See what I mean?
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 14, 2005, 01:49:00 PM
To make it a bit clearer using this very forum (  :) ):

I'd like f.e. to be able to view the Section 'SMF Development' on its own, without seeing the other sections.
The link http://www.simplemachines.org/community/index.php#11 gives me that section on top, but I still see all the others...
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 17, 2005, 06:35:32 AM
Oh dear, did I step on someone's foot or is it just not possible?
Title: Re: Displaying only one Category
Post by: [Unknown] on January 17, 2005, 09:41:19 AM
Why would you want to remove view of the other boards?  To save like a kilobyte of bandwidth?

-[Unknown]
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 17, 2005, 10:26:39 AM
Em, no, but to have the possibility to give away an URL that will show only that very section; to get the impression there were no other sections.
Title: Re: Displaying only one Category
Post by: Trekkie101 on January 17, 2005, 10:54:40 AM
But then clicking home would display it?

You could make the other boards private to stop just anyone getting in and they wouldnt see it until they are premoted.
Title: Re: Displaying only one Category
Post by: A.M.A on January 17, 2005, 12:33:12 PM
In BoardIndex.template.php look for:
Code: [Select]
foreach ($context['categories'] as $category)
{
echo '
<div class="tborder"><table border="0" width="100%" cellspacing="1" cellpadding="5">
replace with:
Code: [Select]
foreach ($context['categories'] as $category)
{

     // if category's link is clicked, display that category only!
if (isset($_REQUEST['catogid']))
  {
        if ($_REQUEST['catogid'] == $category['id'])
           echo '<div class="tborder">';
        elseif ($_REQUEST['catogid'] != $category['id'])
           echo '<div style="display:none;">';
  }
else
  {
        echo '<div class="tborder">';
}

echo '
<table border="0" width="100%" cellspacing="1" cellpadding="5">

look for:
Code: [Select]
', $category['link'], 'replace with:
Code: [Select]
<a href="' . $scripturl . '?catogid=', $category['id'], '">', $category['name'], '</a>
This will enable you to display only one category by clicking on any category or typing its URL. This will only hide the unwanted categories. I made this quick, and did not test for errors proof!
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 17, 2005, 12:42:19 PM
A.M.A, you rock soooo bad! Thanx very much for that hack. Looks absolutely...great. thanx.

PS: this could even go into the main dev tree, methinks.
Title: Re: Displaying only one Category
Post by: Oldiesmann on January 17, 2005, 01:52:11 PM
Nice. Never thought about doing it that way :)
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 17, 2005, 03:45:42 PM
I looked at 'function theme_linktree()' in index.template.php and I don't see an easy way to do what you did in BoardIndex.template.php.
The line in question is prolly 409:
Code: [Select]
echo '<b>', $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '" class="nav">' .
   $tree['name'] . '</a>' : $tree['name'], '</b>';
after the question mark

The URL that's being linked comes from a variable, $tree['url'], which again comes from $context['linktree']. The
Code: [Select]
<a href="' . $tree['url'] . '" would need to be replaced by the catogid link you used before, but it must come from $context['category']. I don't know how to do that...
Title: Re: Displaying only one Category
Post by: A.M.A on January 17, 2005, 05:38:58 PM
Please make a backup first.

in /Soucres/Load.php look for:
Code: [Select]
'url' => $scripturl . '#' . $board_info['cat']['id'],replace with:
Code: [Select]
'url' => $scripturl . '?catogid=' . $board_info['cat']['id'],
Title: Re: Displaying only one Category
Post by: RicochetPeter on January 18, 2005, 01:43:58 AM
kewl. got it. thanx again :-)
Title: Re: Displaying only one Category
Post by: mytreo on January 20, 2005, 01:38:59 PM
Great thread, I needed to do the same and after reading this and messing aorund I have found a way to improve it so I'll share it here with you :)

This new method doesn't just hide the layer it actually changes the database query to only select the category that you want.

Pros:

1) the db query size is only as big as it needs to be, above you are still building ALL the categories into the array, then just hideing them from view
2) works in all browsers
3) the hidden categories disappear completely and no white space remains
4) you don't need to edit the template file

Cons:

1) Not really a con, but you need to edit the boardindex.php file NOT the template file.

How to do it:

Open BoardIndex.php and find the query at the top:

Code: [Select]
// 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 with our new query:

Code: [Select]
// 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['catogid']) ? "
AND c.ID_CAT = {$_REQUEST['catogid']}" : '') . "
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);

That's all!!  Just point at index.php?catogid=X where X is the category you wish to view :D

Example here: Just see the Star Developer Category at mytreo.net (catogid=4) (http://mytreo.net/forum/index.php?catogid=4)

You can add links to the pages in the same way as you did above by editing the template file, or also by using that clever trick above in Load.php to change the linktree.

Hope someone else finds this useful. :)

Chris
Title: Re: Displaying only one Category
Post by: A.M.A on January 20, 2005, 04:56:05 PM
Yup yours is much better .. I guess you could use the tree link modification without any problem. Right?
Title: Re: Displaying only one Category
Post by: mytreo on January 20, 2005, 05:58:12 PM
Yup yours is much better

Wholly inspired by you though, I wouldn't have known where to start otherwise but as I began messing with your code it all came together. I love SMF :D :D

Quote
I guess you could use the tree link modification without any problem. Right?

Yes right, it works just the same.

Chris
Title: Re: Displaying only one Category
Post by: aaronsnet on March 16, 2005, 02:12:01 PM
Anyone have a hack for the classic "BoardIndex.template.php" instead of the default?

thanks!
Title: Re: Displaying only one Category
Post by: A.M.A on March 16, 2005, 05:53:31 PM
please check mytreo's method (http://www.simplemachines.org/community/index.php?topic=24298.msg198169#msg198169) It does not need any template modifications so it will work with any theme.
Title: Re: Displaying only one Category
Post by: Gobo on June 13, 2006, 11:47:54 AM
Great thread, I needed to do the same and after reading this and messing aorund I have found a way to improve it so I'll share it here with you :)

This new method doesn't just hide the layer it actually changes the database query to only select the category that you want.

Pros:

1) the db query size is only as big as it needs to be, above you are still building ALL the categories into the array, then just hideing them from view
2) works in all browsers
3) the hidden categories disappear completely and no white space remains
4) you don't need to edit the template file

Cons:

1) Not really a con, but you need to edit the boardindex.php file NOT the template file.

How to do it:

Open BoardIndex.php and find the query at the top:

Code: [Select]
// 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 with our new query:

Code: [Select]
// 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['catogid']) ? "
AND c.ID_CAT = {$_REQUEST['catogid']}" : '') . "
AND b.ID_CAT = c.ID_CAT
AND b.childLevel <= 1
ORDER BY c.catOrder, b.childLevel, b.boardOrder", __FILE__, __LINE__);

That's all!!  Just point at index.php?catogid=X where X is the category you wish to view :D

Example here: Just see the Star Developer Category at mytreo.net (catogid=4) (http://mytreo.net/forum/index.php?catogid=4)

You can add links to the pages in the same way as you did above by editing the template file, or also by using that clever trick above in Load.php to change the linktree.

Hope someone else finds this useful. :)

Chris

hi

im getting this error

Unknown column 'lb.logTime' in 'field list'
File: /home/.cash/akulion/path-to-peace.net/forum/Sources/BoardIndex.php
Line: 85

im using smf 1.1rc2 with TP
Title: Re: Displaying only one Category
Post by: mytreo on June 13, 2006, 12:03:51 PM
Wow this is an old topic!

That hack won't work with 1.1. The queries are all different.
Title: Re: Displaying only one Category
Post by: Gobo on June 13, 2006, 12:08:39 PM
 :'( what to do?
Title: Re: Displaying only one Category
Post by: mytreo on June 13, 2006, 12:16:15 PM
Well, if you understand what I did with that query then you will be able to use the same approach with 1.1. I'll dig out my 1.1 files and take a look...
Title: Re: Displaying only one Category
Post by: Gobo on June 13, 2006, 12:22:02 PM
thanks :D  :D :D :D :D
Title: Re: Displaying only one Category
Post by: mytreo on June 13, 2006, 12:22:14 PM
Basically, replace this in the top of Sources/BoardIndex.php

Code: [Select]
// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
$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(m.posterTime, 0) AS posterTime,
IFNULL(mem.memberName, m.posterName) AS posterName, m.subject, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName," . ($user_info['is_guest'] ? "
1 AS isRead, 0 AS new_from" : "
(IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED) AS isRead, IFNULL(lb.ID_MSG, -1) + 1 AS new_from,
c.canCollapse, IFNULL(cc.ID_MEMBER, 0) AS isCollapsed") . ",
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,
IFNULL(mods_mem.ID_MEMBER, 0) AS ID_MODERATOR, mods_mem.realName AS modRealName
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
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 mods_mem ON (mods_mem.ID_MEMBER = mods.ID_MEMBER)
WHERE $user_info[query_see_board]" . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);

with this..

Code: [Select]
// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
$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(m.posterTime, 0) AS posterTime,
IFNULL(mem.memberName, m.posterName) AS posterName, m.subject, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName," . ($user_info['is_guest'] ? "
1 AS isRead, 0 AS new_from" : "
(IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED) AS isRead, IFNULL(lb.ID_MSG, -1) + 1 AS new_from,
c.canCollapse, IFNULL(cc.ID_MEMBER, 0) AS isCollapsed") . ",
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,
IFNULL(mods_mem.ID_MEMBER, 0) AS ID_MODERATOR, mods_mem.realName AS modRealName
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
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 mods_mem ON (mods_mem.ID_MEMBER = mods.ID_MEMBER)
WHERE $user_info[query_see_board]
" . (isset($_REQUEST['catogid']) ? "
AND c.ID_CAT = {$_REQUEST['catogid']}" : '') . "
" . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);

Not tested, but it should work.

Chris
Title: Re: Displaying only one Category
Post by: Gobo on June 14, 2006, 04:44:20 PM
Thanks Chris :D

The error is gone but it still dosent work for me

I am also using Tiny Portal, could that be effecting it?

Whenever i type:

http://path-to-peace.net/forum/index.php?catogid=2

It takes me to the board index

Its the same with all categories.

Do you think its a TP conflict or something?

Thanks
Title: Re: Displaying only one Category
Post by: Gobo on June 14, 2006, 04:51:06 PM
yes it seems it is a TP issue

the link tree is different from normal SMf

Code: [Select]

                // Build up the linktree (adding TPortal forum index)
                $context['linktree'] = array_merge(
                        $context['linktree'],
                        array(array(
                                'url' => $scripturl . '?action=forum#' . $board_info['cat']['id'],
                                'name' => $board_info['cat']['name']
                        )),
array_reverse($board_info['parent_boards']),
array(array(
'url' => $scripturl . '?board=' . $board . '.0',
'name' => $board_info['name']
))
);
}


any idea how i can fix it?
Title: Re: Displaying only one Category
Post by: Gobo on June 14, 2006, 05:04:10 PM
aha figured it out and now it works :D

Replace

Code: [Select]

'url' => $scripturl . '?action=forum#' . $board_info['cat']['id'],

With

Code: [Select]

'url' => $scripturl . '?action=forum#' . ';' . '?catogid=' . $board_info['cat']['id'],


in Load.php

And then the URL becomes /index.php?action=forum;catogid=7

Thanks for the code Chris :D thank you so so much :D
Title: Re: Displaying only one Category
Post by: mytreo on June 14, 2006, 05:04:40 PM
Errrm, this link works

http://path-to-peace.net/forum/index.php?action=forum&catogid=5

So that is the format you need to make the links appear in.
Title: Re: Displaying only one Category
Post by: mytreo on June 14, 2006, 05:05:43 PM
Ahh you figured it out, this would be better though (more correct):

Code: [Select]
'url' => $scripturl . '?action=forum' . '&' . 'catogid=' . $board_info['cat']['id'],
Title: Re: Displaying only one Category
Post by: Gobo on June 14, 2006, 05:08:03 PM
oki doki ill update it asap :D thanks :D:D:D:D
Title: Re: Displaying only one Category
Post by: mytreo on June 14, 2006, 05:09:34 PM
No probs, glad to help. Interesting site by the way, especially for those of us who are ignorant about Islam - great work :)
Title: Re: Displaying only one Category
Post by: Gobo on June 14, 2006, 05:26:40 PM
Thanks :D

I am still trying to maintain peace on the boards but every now and then we have the odd extremist from one religion or the other (including islam) coming in to do some bashing...crazy people i tell u!!
Title: Re: Displaying only one Category
Post by: aaronsnet on June 19, 2006, 03:46:39 PM
Basically, replace this in the top of Sources/BoardIndex.php

Not tested, but it should work.

Chris

This does work well on my own board! Thanks! It helps out A LOT!
Title: Re: Displaying only one Category
Post by: mytreo on June 19, 2006, 04:25:46 PM
No worries, tbh it's such a simple modification that I don't know why it isn't in the official release.
Title: Re: Displaying only one Category
Post by: manuelap on August 23, 2006, 03:08:15 PM
I am trying to find a solution for the smf-joomla bridge. To show only one category on a page.... I tried the above hacks but can not make it work  :'(

By the way, I am using SMF 1.1 rc2
Title: Re: Displaying only one Category
Post by: ShawnX on November 25, 2006, 11:41:44 AM
How can we get this hack to work with 1.1 RC3 ?
Title: Re: Displaying only one Category
Post by: shardul on March 22, 2007, 03:42:25 AM
i installed the view single category mod.. i am using smf 1.1.1 with SMFone Blue theme...

when i click on the category name it do not show that single category...
instead it just collapsed...it..
Title: Re: Displaying only one Category
Post by: Floryn on June 02, 2007, 06:24:54 PM
Thank you mytreo for taking the time to show us this hack.

I used it and it works, but one small thing botheres me: It messes up my boards order :(

It shows only one category, but the boards are no longer showed in the defined order. And i don't find any logic in the way it shows them. 

For example:
In a category, I have boards 1, 2 and 3. When i don't use your hack, they appear in the defined order (1, 2, 3). After I replace my $result_boards query with yours, they appear in another order (like 2, 3, 1).  If i click to see all the categories, they appear in the correct order again. Only when i see a category coming from a link with 'catogid' it messes up the order.

I use SMF 1.1.2, but i checked the $result_boards query and is the same as in SMF 1.1.1. And i looked at the entire BoardIndex.php, but couldn't find out what's the problem :(

Any ideas?

Thanks in advance.
Title: Re: Displaying only one Category
Post by: mytreo on August 08, 2007, 11:58:03 AM
It shows only one category, but the boards are no longer showed in the defined order. And i don't find any logic in the way it shows them. 

I've had a look too and can't find why that would be. Surely I'm missing something, but I can't see what.
Title: Re: Displaying only one Category
Post by: eyo on September 02, 2011, 09:40:53 PM
anyone know how to do this in 2.0?
Title: Re: Displaying only one Category
Post by: live627 on September 03, 2011, 12:24:39 AM
Code: (Find in ./Sources/Subs-BoardIndex.php) [Select]
WHERE {query_see_board}'
Code: (Replace the above with) [Select]
WHERE {query_see_board}' . ($boardIndexOptions['include_categories'] && isset($_REQUEST['catogid']) ? "
AND c.ID_CAT = {$_REQUEST['catogid']}" : '')