![]() |
|
How to exclude an album from search function ? - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: How to exclude an album from search function ? (/thread-14073.html) Pages:
1
2
|
How to exclude an album from search function ? - ctdlg - 06-11-2025 Hello, I use the same Zenphoto cms for pictures (PC,tablets, smartphones) and VR headsets. Can I alter the search function so that the VR album + sub-albums are excluded from results ? Thank you in advance ! How to exclude an album from search function ? - acrylian - 06-11-2025 While the searchEngine class has a property for that it for some reason cannot be set directly being protected. Thte searchform function has only a parameter to set where to search but not to exclude. I had to look myself: A small not so elegant workaround seesm to work by re-creating a new searchEngine object. So on your search.php try this right before all the search code:
How to exclude an album from search function ? - ctdlg - 06-11-2025 Thank you so much, it works perfectly. That question and your response could help some other Zenphoto users ! How to exclude an album from search function ? - acrylian - 06-11-2025 I probably just found the more elegant way without neeeding to overwrite the existing search object:
I was not sure if setting that would clear any other search params submitted already but seems to work for me, too. How to exclude an album from search function ? - ctdlg - 22-01-2026 A new question about search and Zenphoto : How to exclude an album from search function ? - acrylian - 22-01-2026
No, as that is what serves the results. All theme files "use" template-functions as that is what "runs" the theme ;-) You of course have to use the function for the search button. And that has a objectlist parameter to limit search: How to exclude an album from search function ? - acrylian - 22-01-2026 The doc is not clear about
You could run into problems if that album is excluded on the search.php page as well. So you possibly need to the check parameters you recieve there to override the exclusion on that occasion. How to exclude an album from search function ? - ctdlg - 23-01-2026 I do not fully understand what I can do. Right now, We can search within the PC section. To have a search within the VR section that excludes the PC section, what do I need to change or add ? How to exclude an album from search function ? - acrylian - 23-01-2026 You need to add a check on what album (and/or subalbum) you are and add the search form to include or exclude that album. Since the search form passes the query to the search page you need to check there what you request. if you there hardcode an exclusion for an album you need to override that here if you actually want to search within that album. Sorry this is a bit more advanced stuff. How to exclude an album from search function ? - acrylian - 23-01-2026 If you use this check on your search.php page:
Right before you need to check if you request that album you excluded.
This is just off hand. I have not tried this or checked the structure of the |