1
javier
Making a search for one module only, need code help inside (yes, i already read the faq)
  • 2005/8/11 0:23

  • javier

  • Not too shy to talk

  • Posts: 184

  • Since: 2002/8/6 1


Hi,
i trying to make a search option only for one module,

I made the first steps after read this faq
https://xoops.org/modules/smartfaq/faq.php?faqid=367
That solve one part of the problem,

But what happen with the results page?
In the results page , in the foot XOOPS show the search form allowing to the user to make a new search in ALL the modules,

How do I modify that to show only one module as option to the new search? (the same module where i made the search before)
I make the first step, a clone search.php file and rename as search2.php, now i suppose i need a searchform.php clone too.
both files will work only with one module.



This is the original searchform.php code

include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";

// create form
$search_form = new XoopsThemeForm(_SR_SEARCH"search""search.php"'get');

// create form elements
$search_form->addElement(new XoopsFormText(_SR_KEYWORDS"query"30255htmlspecialchars(stripslashes(implode(" "$queries)), ENT_QUOTES)), true);
$type_select = new XoopsFormSelect(_SR_TYPE"andor"$andor);
$type_select->addOptionArray(array("AND"=>_SR_ALL"OR"=>_SR_ANY"exact"=>_SR_EXACT));
$search_form->addElement($type_select);
if (!empty(
$mids)) {
    
$mods_checkbox = new XoopsFormCheckBox(_SR_SEARCHIN"mids[]"$mids);
} else {
    
$mods_checkbox = new XoopsFormCheckBox(_SR_SEARCHIN"mids[]"$mid);
}
if (empty(
$modules)) {
    
$criteria = new CriteriaCompo();
    
$criteria->add(new Criteria('hassearch'1));
    
$criteria->add(new Criteria('isactive'1));
    if (!empty(
$available_modules)) {
        
$criteria->add(new Criteria('mid'"(".implode(','$available_modules).")"'IN'));
    }
    
$module_handler =& xoops_gethandler('module');
    
$mods_checkbox->addOptionArray($module_handler->getList($criteria));
}
else {
    foreach (
$modules as $mid => $module) {
        
$module_array[$mid] = $module->getVar('name');
    }
    
$mods_checkbox->addOptionArray($module_array);
}
$search_form->addElement($mods_checkbox);
if (
$xoopsConfigSearch['keyword_min'] > 0) {
    
$search_form->addElement(new XoopsFormLabel(_SR_SEARCHRULEsprintf(_SR_KEYIGNORE$xoopsConfigSearch['keyword_min'])));
}
$search_form->addElement(new XoopsFormHidden("action""results"));
$search_form->addElement(new XoopsFormHiddenToken('id'));
$search_form->addElement(new XoopsFormButton("""submit"_SR_SEARCH"submit"));
?>


Im not a programmer, but i can see is something related with $mids ,$available_modules ,etc

I suppose i have to replace in any way $available_modules with my mids module number 14 (the module id) them the script will take only these module and not all the modules.

Somebody can give me a hand here?


Thanks in advance!
Best Regards
Javier

Login

Who's Online

179 user(s) are online (140 user(s) are browsing Support Forums)


Members: 0


Guests: 179


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