• Welcome to Simple Machines Community Forum. Please login or sign up.
January 28, 2022, 08:24:22 AM

News:

Join the Facebook Fan Page.


Displaying only one Category

Started by RicochetPeter, January 14, 2005, 06:26:12 AM

Previous topic - Next topic

mytreo

Wow this is an old topic!

That hack won't work with 1.1. The queries are all different.
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Gobo


mytreo

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...
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Gobo


mytreo

Basically, replace this in the top of Sources/BoardIndex.php


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


// 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
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Gobo

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

Gobo

yes it seems it is a TP issue

the link tree is different from normal SMf



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

Gobo

aha figured it out and now it works :D

Replace



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


With



'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

mytreo

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.
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

mytreo

Ahh you figured it out, this would be better though (more correct):

'url' => $scripturl . '?action=forum' . '&' . 'catogid=' . $board_info['cat']['id'],
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Gobo

oki doki ill update it asap :D thanks :D:D:D:D

mytreo

No probs, glad to help. Interesting site by the way, especially for those of us who are ignorant about Islam - great work :)
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Gobo

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!!

aaronsnet

Quote from: mytreo on June 13, 2006, 12:22:14 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!

mytreo

No worries, tbh it's such a simple modification that I don't know why it isn't in the official release.
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

manuelap

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

ShawnX

How can we get this hack to work with 1.1 RC3 ?

shardul

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..

Floryn

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.

mytreo

Quote from: Floryn on June 02, 2007, 06:24:54 PM
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.
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Advertisement: