Elxis CMS Forum
Extensions => Modules => Topic started by: e-isodos on January 21, 2011, 16:32:23
-
Hi
Is there a way to exclude content items from search results ?
-
Yes you can, but I need more info to reply to you.
You want to exclude specific content items, whole categories, sections, or what?
Give me some more information on what you want to do.
-
Exclude whole Sections and items (of different sections)
-
As the search bot has only the "limit" as parameter to exclude elements you have to modify the bot source code.
Here is an example on how to do it for the sections.
file: mambots/search/sections.searchbot.php
I write a string of comma separated section ids we want to exclude:
$exclude = '1,4,7,12';
I will now add a new line inside the query (with green the new line I just added):
. "\n AND a.published = '1'"
. "\n AND a.id NOT IN (".$exclude .")"
. "\n AND a.access IN (".$my->allowed.")"
That's it!
Do the same for the other search bots.
-
Thank you,
I will try it and let you know
-
Is it possible to change the view of search results from being displayed at frontpage to other menu item?
Or if this is not possible (or hard to do) how I can change the header of the frontpage with "if"
-
The last question was stupid !!
Just make a menu item ( Component - Search) and the results are at a new page
-
As the search bot has only the "limit" as parameter to exclude elements you have to modify the bot source code.
Here is an example on how to do it for the sections.
file: mambots/search/sections.searchbot.php
I write a string of comma separated section ids we want to exclude:
$exclude = '1,4,7,12';
I will now add a new line inside the query (with green the new line I just added):
. "\n AND a.published = '1'"
. "\n AND a.id NOT IN (".$exclude .")"
. "\n AND a.access IN (".$my->allowed.")"
Do the same for the other search bots.
That's it!
Doesn't work. I made the same search with your code and without, but the results are just the same (still contains sections I don't want to be resulted.)
-
In Elxis 4.x, this line works, if it helps anyone! ."\n AND a.catid NOT IN (".$exclude ='8,59,38,39,40,52,54'.")"
The numbers are changed of course to the category IDs specific to your site.