1
Cozzie
How to show forum posts related to a pages/category's name
  • 2009/5/11 5:22

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


Hi there

Can anyone tell me how i might be able to do the following:

I want to show any posts in my newbb forum that are related to the page name or category name of other pages in my site (which happen to use the smartsection module).

So for example I use smartsection module to have information about different schools, each category page name in the module is a school's name. On each category page I would like to show a list of posts in my forum that mention the school.

I think this would be really useful to my readers and to anyone with a forum website as it will draw readers in to the forum.

So far I have tried to adapt the newbb block which shows the latest posts in the forum.

I have changed the code to return any posts which have a certain word in their subject or text but the problem is I can't figure how to make the newbb block understand what the page/category name is of the smartsection module.

I'm using XOOPS 2.0.18 - can anyone help me? thanks a lot!

2
hipoonios
Re: How to show forum posts related to a pages/category's name
  • 2009/5/11 7:09

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


I cant help you. But I want to do something similar. Have a recent forum block for a specific forum.

Anyone?
I love Xoops!

3
DarinAllan
Re: How to show forum posts related to a pages/category's name

Is this something like what you want, bear in mind it is just one page but I have added a mytabs block which shows each forum by the states of Australia. So my guess is you may be able to do something similar. Mytabs is very good for cloning blocks, then you can make the blocks show a specific forum, well something like that anyway.

pseudo Community module

Make sure you look at the whole page! (The top part is just some RSS2Email stuff for each states forum).

If I understand you correctly cozzie you may be able to do something like that, except the forum blocks could just be one block per school on a static page achieved with the "dummy" module. ;o)

4
hipoonios
Re: How to show forum posts related to a pages/category's name
  • 2009/5/11 10:17

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Thanks I didnt think about the MyTabs module. But I found another solution. Its possible to choise which forums to include in CBB and clone the block. No need for any modules or hacks.
I love Xoops!

5
DarinAllan
Re: How to show forum posts related to a pages/category's name

Quote:

hipoonios wrote:
Its possible to choise which forums to include in CBB and clone the block.


Yep sure is ;o)

6
Cozzie
Re: How to show forum posts related to a pages/category's name
  • 2009/5/12 2:29

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


Hi Darin

thanks a lot, but if I understand you correctly that's not what I want to do.

Here is what I've done so far:

I've added the newbb 'latest posts' block to my smartsection pages

then in the file which controls this block (modules/newbb/blocks/newbb_block.php) I have gone to the appropriate function (function b_newbb_show($options)) and I have made this little change:

the original code was:

$approve_criteria ' AND t.approved = 1 ';

I have changed it to:

$approve_criteria ' AND t.approved = 1 AND t.topic_title LIKE "%oxford%" OR t.topic_subject LIKE "%oxford%" OR x.post_text LIKE "%oxford%"';


OK, so like this on my category pages in the smartsection module I have a block which shows a list of any forum questions which mention Oxford.

The thing is I can't figure out how to make that be a variable dependent on the page title (which is each schools name). I'm guessing it should be something like:

$approve_criteria ' AND t.approved = 1 AND t.topic_title LIKE "%($school_name)%" OR t.topic_subject LIKE "%($school_name)%" OR x.post_text LIKE "%($school_name)%"';


And that I need to send a variable called $school_name to the newbb/blocks/newbb_block.php ($school_name being the name of each page title in my smartsection module).

I'm really not sure if I'm explaining myself well here, thanks a lot for any further help

Cheers!

7
Cozzie
Re: How to show forum posts related to a pages/category's name
  • 2009/5/15 4:29

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


Just to recap I'm trying to modify the newbb 'Latest posts' block so that it can be used to show the latest posts according to the page of the website being viewed.

So for example i have a module which is all about colleges, each category in that module is a different college. It would be great if on each category page I could display forum posts which mention that college. I think this might be useful for a lot of sites.

So the aim is to have the block return posts according to the page currently being viewed

within this file: /modules/newbb/blocks/newbb_block.php

this function: b_newbb_show

controls the latest posts block

but how can i tell this function what the page name is of the page in which the block is currently being viewed.

I'm using this hack inside the category's template page to call the block:

<{php}>
include XOOPS_ROOT_PATH.'/mainfile.php';
include_once XOOPS_ROOT_PATH.'/class/template.php';
include_once(XOOPS_ROOT_PATH.'/modules/newbb/blocks/newbb_block.php');
$result = b_newbb_show(explode('|','time|10|360|0|1|0|0'));
$tpl = new XoopsTpl();
$tpl->assign('block', $result);
$tpl->display('db:newbb_block_cover.html');
<{/php}>

As this is within the module's category page is there some way I can send the $category.name to newbb_block.php

Thanks a lot for bearing with me!

8
Cozzie
Re: How to show forum posts related to a pages/category's name
  • 2009/5/21 2:40

  • Cozzie

  • Not too shy to talk

  • Posts: 133

  • Since: 2007/7/13


can anyone help? thanks!

Login

Who's Online

313 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 313


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits