Seperate search for pages/news and images

For a site I now have a blog section and a gallery section. In the sidebar I have the searchform. What I would like is for the searchform to display only searchresults from pages/news when done from within the blog section, and only images when done from within the gallery section. Therefore (I guess), I could split the search.php template up into searchalbums.php and searchnews.php, but maybe there's an easier way?

Comments

  • acrylian Administrator, Developer
    This is how I would try it with one search page. There are options for images, albums, news and pages to be searched. As with all options you can temporarily or permanently set them to something else.
    http://www.zenphoto.org/documentation/functions/_functions-basic.php.html#functionsetOption

    These are the option names for the four search items:
    search_no_albums, search_no_news, search_no_pages, search_no_images

    You would have to temporarily set this on the page type you have the search page and then probably have to make a custom searchform that appends a GET or POST statement so that the search page "knows" (as temporatily set options vanish on the search page naturally) that it has to set the options as well. Or you could check from what page you came using the HTTP referrer maybe.

    Or you set the options permanently and reset them on the search page after the results (of course then the search there would be for all types again).

    Sounds like a good idea to have this as a parameter for the search form (you can already limit search to one or more specific album btw). Please open a ticket as well.

    Splitting would be an easy way but you would need custom search forms as well.
  • As a parameter it would be easier ;) but for now I will try you suggestions. Thanks.
  • acrylian Administrator, Developer
    Probably 1.3.2 will have an easier way for this (might require theme changes though).
Sign In or Register to comment.