Current

This document is valid for the current version of Plone.

Search Templates

by Plone Documentation Team last modified Jul 07, 2012 06:23 AM

Search has been dramatically improved in 4.2, but that means that any customizations you may have made could be gone or just plain won't work. If you previously customized search in your custom folder or anywhere in skins, note that your shizzle won't work anymore.

You can do two things (I think - I'm sure there is a better way but if anyone has an idea paste it here!). You can keep your search form and all of it's logic in template mumble jumble. That info is below but why would you want to do that? I recommend customizing the shiny NEW search template to have your changes once again since it's just so gosh darn pretty.

To upgrade your sites search to be more like what you want (and flex your brain), copy plone.app.search/plone/app/search/search.pt into your templates folder in your product. Something like my.site/my/site/browser/templates/mysite_search.pt. I recommend using another name besides search.pt for sanity. Then override the search view to use the new template in your configure.zcml (likely in browser):

<browser:page
 name="search"
 class="plone.app.search.browser.Search"
 permission="zope2.View"
 for="Products.CMFPlone.interfaces.IPloneSiteRoot"
 layer="my.site.interfaces.IMySiteLayer"
 template="templates/mysite_search.pt"/>

Restart and make sure that's all working. Then update that search template to have all your changes that you had in the old template.

If you aren't convinced by the boat load of pretty that is the new search form, don't copy or paste anything and just omit the class= line in the code above. You can paste your old template as is. I'll sigh for you... *sigh*. It will look something like

<browser:page
 name="search"
 permission="zope2.View"
 for="Products.CMFPlone.interfaces.IPloneSiteRoot"
 layer="my.site.interfaces.IMySiteLayer"
 template="templates/search.pt"/>