How to: Frame a search center with little work

Lately I have encountered several customs who deploy search from SharePoint 2010, but they still have other solutions running on MOSS 2007 or other portal frameworks. Instead of creating custom solutions using the search service on SharePoint 2010, framing is a quick solution to get you up and running.

One way is to create a custom master page to replace v4.master for the search center, but this requires html knowledge and tinkering. In many cases it’s just as easy to go the configuration way.

Hello IsDlg=1and s4-notdlg

You have probably seen throughout SharePoint 2010 that it opens modal dialogs for different tasks. For example if you want to create a new site you get a dialog looking something like this

image

The source for this page is loaded from /_layouts/AddGallery.aspx?IsDlg=1

The part to note is the appending of IsDlg=1 which tells the page it is rendered in a modal dialog. In effect this will change some styles for the page which hides the ribbon and top menus based on the style sheet class s4-notdlg. (MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.unsecuredlayoutspagebase.isdialogmode.aspx).

In order for a page to frame in search they will merely append IsDlg=1 to the search center url.

image

Unfortunately the IsDlg=1 parameter is not added automatically to all links. There are a couple of places we need to edit.

First off is the  Advanced link. Edit the search page and append IsDlg=1& to the link

image

After saving switch over to the People search box and do the same edit for the people search result page.

In theory we could add ?IsDlg=1 to the result page link as well, but this won’t work as ?k=searchterm is added in front of it, and two question marks in the url messes up the parsing.

Instead we modify the xslt for the result pages by a small style sheet entry.

This can be places below <xsl:template match=”/”>  at the end of the default xslt. Do the same for the xslt on the people search result page.

The caveat with setting the s4-notdlg style is that it will hide the ribbon menus regardless of the IsDlg query parameter. This leads us to have one search center for framing and one which is used natively in SharePoint 2010.

So the question remains, is it better to rely on IsDlg and s4-notdlg or should I go for a custom master page?

Article written by

Computer literate and search enthusiast with an interest for sharepoint, coding, and life in general :)


Leave a response





XHTML: These tags are allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Page not found - Sweet Captcha
Error 404

It look like the page you're looking for doesn't exist, sorry

Search stories by typing keyword and hit enter to begin searching.


OSLO

Comperio AS
Øvre Slottsgate 27
NO-0157 Oslo,
Norway
+47 22 33 71 00
View map

STOCKHOLM

Search Provider Sverige AB
Gamla Brogatan 34
SE-11 120 Stockholm
Sweden
+46 8-21 49 00
View map