Topic: Disable Search for a Category

Hi,  I would like to disable Search for a particular category. The idea being that I want to use one page of my website for publication of documents in draft form that will be accessed by some users who are developing reports etc.  The trouble is that Cutenews Search will find the documents on the new page. If i could disable Search from finding any posts in a particular Category that would enable the page to be hidden.

Re: Disable Search for a Category

If we get it right, you need to perform a search that would exclude some categories from the search results. This functionality hasn't been introduced yet, but you can use this "trick":

   // Check category (exclude for search)
   if ($item['c']) {
       $categories = explode(',', $item['c']);
    if (isset($category_exclude) && array_intersect($categories, $category_exclude)) {
        continue;
       }
   }

in the search.php file before the line

  $MB = function_exists('mb_strtolower');

Before

include 'search.php'

set the parameter

$category_exclude = '1,2,3,4'

(numbers are the ones for the categories to be excluded from the search results). If you insert

$category_exclude = ''

nothing will be excluded, if

$category_exclude = '1'

then the news with category '1' will be excluded (the numbers for the categories can be checked in the admin panel under the categories tab).

Best regards,
CN Support team

Re: Disable Search for a Category

Thanks I'll try that and post back

4 (edited by edwards 2018-05-01 19:54:11)

Re: Disable Search for a Category

Hi I have added the code and get a blank screen.  There was a missing semicolon in the original code that I added. I am using Cutenews 2002. I did copy and paste so the code should be ok.

Re: Disable Search for a Category

It may be that the code is not compatible with the version you are using. Please indicate the version number of the Cutenews you are using, i.e. 2.0, 2.3, 1.3, etc.

Best regards,
CN Support team

Re: Disable Search for a Category

hi Thanks  version number 2.0.2 build ID-202

Re: Disable Search for a Category

Hello edwards.  Yes, your version is may be not compatible or sported for which code you are using.

Re: Disable Search for a Category

edwards wrote:

hi Thanks  version number 2.0.2 build ID-202

We appologize for the code. It misses ";" and the version 2.0.2 is compatible with it.

The corrected code:
You should use the code below instead of the one above

// Check category (exclude for search)
               if ($item['c']) {
                   $categories = explode(',', $item['c']);
                   $_categoryex = explode(',', $category_exclude);
                   if (isset($category_exclude) && array_intersect($categories, $_categoryex)) {
                       continue;
                   }
               }
Best regards,
CN Support team

Re: Disable Search for a Category

Hi Thanks Support. All working fine !

10 (edited by khui9 2018-09-15 11:07:25)

Re: Disable Search for a Category

Support_Team wrote:
edwards wrote:

hi Thanks  version number 2.0.2 build ID-202

We appologize for the code. It misses ";" and the version 2.0.2 is compatible with it.

The corrected code: bk experience

You should use the code below instead of the one above

// Check category (exclude for search)
               if ($item['c']) {
                   $categories = explode(',', $item['c']);
                   $_categoryex = explode(',', $category_exclude);
                   if (isset($category_exclude) && array_intersect($categories, $_categoryex)) {
                       continue;
                   }
               }

This worked perfectly, Thanks support team.

Re: Disable Search for a Category

How to Activate and confirm American Express Card

Re: Disable Search for a Category

It may be that the code is not compatible with the version you are using. Please indicate the version number of the Cutenews you are using, i.e. 2.0, 2.3, 1.3, etc.
https://grandapk.com

https://techandskill.com/watch-cartoons-online/

Re: Disable Search for a Category

hi Thanks  version number 2.0.2 build ID-202

https://latestmenuprice.com

https://techandskill.com/watch-cartoons-online/

Re: Disable Search for a Category

Hey Community Group 2.0.2 build ID-202 Version Is Good Worked

http://www-hotmail-com.email

Re: Disable Search for a Category

https://tractorhub.wixsite.com/swarajtractor

Swaraj models have special features suitable for agriculture and haulage application. The company ensures the best models with a warranty period of 2 years or 2000 hours from the date of purchase.

Re: Disable Search for a Category

khui9 wrote:
Support_Team wrote:
edwards wrote:

hi Thanks  version number 2.0.2 build ID-202

We appologize for the code. It misses ";" and the version 2.0.2 is compatible with it.

The corrected code: bk experience

You should use the code below instead of the one above

// Check category (exclude for search)
               if ($item['c']) {
                   $categories = explode(',', $item['c']);
                   $_categoryex = explode(',', $category_exclude);
                   if (isset($category_exclude) && array_intersect($categories, $_categoryex)) {
                       continue;
                   }
               }

This worked perfectly, Thanks support team.


my problem is solved too, thanks

17 (edited by David7133 2021-10-26 04:13:03)

Re: Disable Search for a Category

Everything is very open with a clear description of the issues. It was truly informative. https://www.upsers.onl/

18 (edited by Raymond6822 2021-10-28 04:22:17)

Re: Disable Search for a Category

Looking great work dear, I really appreciated to you on this quality work. https://www.jcpenneykiosk.bid/

Re: Disable Search for a Category

Great one. Thanks a lot. https://www.surveymayor.com/mybkexperience/