1
rlankford
Module specific search section?
  • 2006/7/23 15:49

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


I apologize in advance if this is in the wrong forum or if this has been answered before.

I am in the process of creating my first custom module for an intranet site. I am basing it off Magazine (which was based off WF-Sections). I would like to include an area on each page in the module that contains a search "block" of sorts.

I want this to function like the advanced search page. I don't want to display all the module names, however. Instead, I would like to hardcode this to limit searches to this specific module. If the user wants to do a specific search, there are the general XOOPS search facilities located elsewhere in the theme.

The search.php code just confuses me, so I was wondering if someone had done this before for one of their themes and had some quick and handy code they could paste here to help me out.

Beyond that, a quick and dirty explanation of how it works would be great -- I'd love to have a better understanding of how this works.

Thanks in advance!

2
rlankford
Re: Module specific search section?
  • 2006/7/24 13:57

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


Well, I've answered my own question! Here's how you do it:

First off, the search form needs to include those elements that you need to send to the submit page to make it work. In this case, all I need is the forum elements present on the standard XOOPS search block, along with the additional checkbox element that tells the search page to limit searches to my module. This additional element has it's display set to 'none' so as not to confuse the user.

First off, add a statement like the following to the php page associated with whatever page you need your module specific search on:

$xoopsTpl->assign('thisModuleID'$xoopsModule->getVar'mid' ));


Second, add the following code to the appropriate template page that the above php uses to generate the html for the user:

<form style="margin-top: 0px;" action="<{$xoops_url}>/search.php" method="get">
  <
input type="text" name="query" size="34" />
  <
input type="hidden" name="action" value="results" /><br />
  <
span style="display: none"><input type='checkbox' name='mids[]' value='<{$thisModuleID}>' checked='checked' />module name could go herebut we don't care since it's hidden anywayspan>
  <
input type="submit" value="Submit" />
form>


That's it! I hope this helps someone out. Feel free to use and/or post this code however you like!

3
carnuke
Re: Module specific search section?
  • 2006/7/24 14:38

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


There is a a FAQ about this HERE, but thanks for your findings.
hhttp://houseofstrauss.co.uk Resource for alternative health and holistic lifestyle
search xoops

4
rlankford
Re: Module specific search section?
  • 2006/7/24 21:50

  • rlankford

  • Not too shy to talk

  • Posts: 158

  • Since: 2004/8/27


Oooh sure. Now that I've gotten it all figured out, you come to the rescue with the faq link!


Login

Who's Online

348 user(s) are online (252 user(s) are browsing Support Forums)


Members: 0


Guests: 348


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