1
RiazShahid
How can I customize search results to show categories and titles in it

I have loads of categories in smart section and a lot of titles in news module. Is it possible to show "category" and "Title" names in search results? If yes, then how I can do that? thanks for your assistance

2
christian
Re: How can I customize search results to show categories and titles in it
  • 2007/8/5 15:20

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


With the news module, you must edit the news/include/search.inc.php


......
//    $sql = "SELECT storyid, topicid, uid, title, created FROM ".$xoopsDB->prefix("stories")." WHERE (published>0 AND published<=".time().") AND (expired = 0 OR expired > ".time().') ';
    
$sql "SELECT storyid, topicid, uid, title, [b]topic_title[/b], created FROM ".$xoopsDB->prefix("stories")." [b]as s left join ".$xoopsDB->prefix("topics")." as t on s.topicid = t.topic_id[/b] WHERE (published>0 AND published<=".time().") AND (expired = 0 OR expired > ".time().') ';
.......

if (
$display) {
            
$ret[$i]['image'] = "images/forum.gif";
            
$ret[$i]['link'] = "article.php?storyid=".$myrow['storyid']."".$searchparam;
            
$ret[$i]['title'] =[b$myrow['topic_title']." - [/b]".$myrow['title'];
            
$ret[$i]['time'] = $myrow['created'];
            
$ret[$i]['uid'] = $myrow['uid'];
            
$i++;
        }

For smartsection, it's similar.

3
RiazShahid
Re: How can I customize search results to show categories and titles in it

Thanks a lot Christian!
Actually I wanted an option in search results so that users might search any specific categories only. In XOOPS module based search is available by default. Users can specify any specific module to search from. I wonder is it possible to search based on categories in smart section module.......or even in news module. So that they might check or uncheck categories names, to search. I shall be highly grateful for any sort of assistance.

4
rlankford
Re: How can I customize search results to show categories and titles in it
  • 2007/8/16 12:19

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


This is certainly an interesting idea. I've seen modules that implement their own search function. In these cases, they don't rely on the XOOPS search engine API. Rather, they provide a search form inside their module and generate page results however they'd like themselves. So for a module that you are personally developing, this might be a desirable path for you to take.

If, however, you are dealing with other people's modules. Well, you are left with hacking them (like christian's excellent suggestion). Do an elegant enough hack and submit it back to the module developer, however, and it just might become part of that module in the future.

But that still isn't really what you're going for (as far as I can tell). You're asking for the type of change that challenges the very design of the XOOPS search API. It would be interesting, however, to add the concept of 'categories' to the XOOPS search engine concept. Each module would have to define in the xoops_version.php file a way for XOOPS to know what categories are available and how to access these categories. The search engine could then be altered to allow for filtering not only by module, but by category as well.

All of this, obviously, would need to be backward compatible with the existing search engine so that older modules can still be useful in Xoops.

Hmmm..... This might be a fun little project to work on. Anyone else intested in something like this??

Login

Who's Online

300 user(s) are online (228 user(s) are browsing Support Forums)


Members: 0


Guests: 300


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