How can I restrict search.cgi to search only specific categories?

Several categories on my client's site will be password protected.

Search.cgi will be called from two different, dynamically called menu.html files. (My search box is in my menu bar.) I set up two menu.html files: one for the unprotected pages, the other for the protected pages.

After the form is called into action, here is the hidden code I included:

<!--
<input type="hidden" name="sortBy" value="fieldname, -fieldnameReverseOrder, fieldname">
<input type="hidden" name="keywordSearchFields" value="Title">
-->

I know I can use something like this to restrict the search to one category:

<input type="hidden" name="catNum" value="29" />

How do I code the search.cgi call if I want to restrict the search to catNum 1 - 28, for example?

Do I have to enter a hidden catNum for each value (1-28)?

Re: [marys] Search only specific categories

Try this:

<input type="hidden" name="categoryNum" value="12,29,36,44">

I hope this helps. :)
Donna

--
support@interactivetools.com

Re: [Donna] Search only specific categories

By marys - April 25, 2009 - edited: April 25, 2009

Thanks, Donna, but...

I now get this error:

Error: no category specified! at /home/changed/chan/f/a/666666/html/artman2/modules//IT/ArtMan/CustomMenus/Publish.pm line 486.

(I edited the directory names to protect the info, but all from "/html" is original.)

My hidden values look like this:

<input type="hidden" name="action" value="search"/>
<input type="hidden" name="categoryNum" value="101,19,20,21,22,24,62,67,68">

Re: [marys] Search only specific categories

Hi marys

Thanks for the feedback.

The error message you are getting there usually means you have a publish rule set to only include certain categories but haven't actually selected any categories for it.

What you'll want to do is go through your article list publish rules and make sure any of them that are set to include or exclude actually have something selected in the category list.

Does that make sense? Have a look and let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [marys] Search only specific categories

Hi Mary,

Instead of including the search string in the form action, you'll want to include it as a separate field like this:

<input type="hidden" name="categoryNums" value="101,19,20,21,22,24,62,67,68">

I hope this helps. :)
Donna

--
support@interactivetools.com