Adding an additional search to the WSS search page


Now, I wrote this post ages ago, then hesitated in posting it, the reason is because it actually shows you how to do something that I generally don’t recommend. Before releasing it I was going to write this big long post about the way I think about customisation and SharePoint, I might still do it, but it ended up being bigger than the Internet, and I got bored, and it caused a “Blog Jam” and I never got around to finishing it. In addition to this, it also got overtaken by the release of  898631 , need I say more.


It may come back, we shall see.


Now, back to the point, I would not normally recommend touching ANYTHING in the “Layouts” folder, however, sometimes customers really need to have a feature. When I’ve been faced with this, I’ve done it providing I consider the impact minimal, but told them at great length that it’s a bad idea and warned of the impact of such changes (we all know them, service packs, supportability, etc). Finally, the other reason I feel ok about posting is that we (Microsoft) have published many articles to MSDN that include modifying pages in the “Layouts” folder, so, it’s not like I’m the first.


Anyway, while this is a pretty minor change, it’s still made at your own risk, and will most likely be overwritten by the application of service packs, hotfixes, natural disasters, etc.


———————– Post Starts here ————————


In a Windows SharePoint Services site that is “connected” to a portal you get the ability to send a search submitted on a team site to the portal:


SearchPortal


Sometimes you may want to:
– Refine the search, for example restricting it to just a specific content source
– Add an extra one.


The below instructions will take you through how to do it.


1. Open the following file:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\<locale ID>\searchresults.aspx


2. Search for the following code section:
<asp:PlaceHolder Runat=”server” ID=”PanelPortalSearch”>


3. Look for it’s closing tag (ie. </asp:PlaceHolder>)and insert the following immediately above it:
  <tr>
   <td class=”ms-vb”>
     <IMG SRC=”/_layouts/images/blank.gif” width=3 height=1 alt=””><img src=”/_layouts/images/rect.gif” alt=””><IMG SRC=”/_layouts/images/blank.gif” width=4 height=1 alt=””>
     <script>
     var searchTerm


     searchTerm = ‘<a href=”/search.aspx?s=test&k=’ + ‘<% SPEncode.WriteScriptEncode(Response, m_strSearchTerm); %>’ + ‘”>Search Portal</a>’;
     document.write(searchTerm);
     </script>
   </td>
  </tr>


4. Save and test.


The result should look something like this:


NewSearchPortal


Now lets take a closer look at the code, because you are going to need to change it to suit:


Section A
  <tr>
   <td class=”ms-vb”>
     <IMG SRC=”/_layouts/images/blank.gif” width=3 height=1 alt=””><img src=”/_layouts/images/rect.gif” alt=””><IMG SRC=”/_layouts/images/blank.gif” width=4 height=1 alt=””>
This bit basically just creates a new row in the table for me to place the new search link, as well as formatting it exactly like the standard link.


Section B
     <script>
     var searchTerm
This bit kicks off the script we are going to write to output the correct link for doing the search


Section C
     searchTerm = ‘<a href=”/search.aspx?s=test&k=’ + ‘<% SPEncode.WriteScriptEncode(Response, m_strSearchTerm); %>’ + ‘”>Search Portal</a>’;
This is the meaty bit.


The section in the first quotes (‘) sets up the URL to the Portal search.aspx page, in this case the portal is on the same virtual server as my team site, note that this may not be the case, and you may need to modify this. It also hardcodes a specific scope for me to perform my search within, in this case the scope is called “Test”, you may need to change this to suit. For a full list of parameters you can feed to the Search.ASPX page see the SDK, section titled: “Using GET on the Search Page”.


The next section in quotes (‘) pulls back the search term submitted to the page, this is actually executed server side, as indicated by the “<% %>” tags.


The final section in quotes (‘) is simply the text you want on your link.


Section D
     document.write(searchTerm);
This is just the Javascript function that writes the contents of the variable setup in section A into the browser.


Finally, you need to put it inside the <asp:PlaceHolder> so that your link is hidden on sites that are not connected to the Portal. So there you go, I will be the first to admit that I’m a pretty average Javascript coder, so you may have a better approach. Thats exactly what the comments are for, look forward to them.


Comments (3)

  1. Dan Bauhaus says:

    Or if you don’t want to code and maintain customizations, you can use Coveo Enterprise Search for SharePoint which does these features and dozens of other ones out of the box.

    -Dan

  2. 机票 says:

    [[http://yxnet.s9.xrea.com/hot/index1.htm]]视频会议

    [[http://yxnet.s9.xrea.com/hot/index2.htm]]数码相机

    [[http://yxnet.s9.xrea.com/hot/index3.htm]]笔记本

    [[http://yxnet.s9.xrea.com/hot/index4.htm]]笔记本电脑

    [[http://yxnet.s9.xrea.com/hot/index5.htm]]鲜花

    [[http://yxnet.s9.xrea.com/hot/index6.htm]]礼品

    [[http://yxnet.s9.xrea.com/hot/index7.htm]]成人用品

    [[http://yxnet.s9.xrea.com/hot/index8.htm]]性用品

    [[http://yxnet.s9.xrea.com/hot/index9.htm]]二手房

    [[http://yxnet.s9.xrea.com/hot/index10.htm]]网站建设

    [[http://yxnet.s9.xrea.com/hot/index11.htm]]虚拟主机

    [[http://yxnet.s9.xrea.com/hot/index12.htm]]移民

    [[http://yxnet.s9.xrea.com/hot/index13.htm]]投资移民

    [[http://yxnet.s9.xrea.com/hot/index14.htm]]技术移民

    [[http://yxnet.s9.xrea.com/hot/index15.htm]]加拿大移民

    [[http://yxnet.s9.xrea.com/hot/index16.htm]]移民加拿大

    [[http://yxnet.s9.xrea.com/hot/index17.htm]]租房

    [[http://yxnet.s9.xrea.com/hot/index18.htm]]北京租房

    [[http://yxnet.s9.xrea.com/hot/index19.htm]]上海租房

    [[http://yxnet.s9.xrea.com/hot/index20.htm]]广州租房

    [[http://yxnet.s9.xrea.com/hot/index21.htm]]租车

    [[http://yxnet.s9.xrea.com/hot/index22.htm]]汽车租赁

    [[http://yxnet.s9.xrea.com/hot/index23.htm]]上海租车

    [[http://yxnet.s9.xrea.com/hot/index24.htm]]上海汽车租赁

    [[http://yxnet.s9.xrea.com/hot/index25.htm]]拓展

    [[http://yxnet.s9.xrea.com/hot/index26.htm]]拓展训练

    [[http://yxnet.s9.xrea.com/hot/index27.htm]]拓展培训

    [[http://yxnet.s9.xrea.com/hot/index28.htm]]数据恢复

    [[http://yxnet.s9.xrea.com/hot/index29.htm]]美容

    [[http://yxnet.s9.xrea.com/hot/index30.htm]]整形

    [[http://yxnet.s9.xrea.com/hot/index31.htm]]传奇私服

    [[http://yxnet.s9.xrea.com/hot/index32.htm]]免费电影

    [[http://yxnet.s9.xrea.com/hot/index33.htm]]招聘

    [[http://yxnet.s9.xrea.com/hot/index34.htm]]律师

    [[http://yxnet.s9.xrea.com/hot/index35.htm]]律师事务所

    [[http://yxnet.s9.xrea.com/hot/index36.htm]]足球

    [[http://yxnet.s9.xrea.com/hot/index37.htm]]减速机

    [[http://yxnet.s9.xrea.com/hot/index38.htm]]机票

    [[http://yxnet.s9.xrea.com/hot/index39.htm]]国际机票

    [[http://yxnet.s9.xrea.com/hot/index40.htm]]打折机票

    [[http://yxnet.s9.xrea.com/hot/index41.htm]]特价机票

    [[http://yxnet.s9.xrea.com/hot/index42.htm]]飞机票

    [[http://yxnet.s9.xrea.com/hot/index43.htm]]航班查询

    [[http://yxnet.s9.xrea.com/hot/index44.htm]]航班时刻表

    [[http://yxnet.s9.xrea.com/hot/index45.htm]]货架

    [[http://yxnet.s9.xrea.com/hot/index46.htm]]条码

    [[http://yxnet.s9.xrea.com/hot/index47.htm]]管理咨询

    [[http://llhx.nease.net/dnzx/index.htm]]美容

    [[http://llhx.nease.net/dnzx/index1.htm]]整形

    [[http://llhx.nease.net/dnzx/index2.htm]]整容

    [[http://llhx.nease.net/dnzx/index3.htm]]减肥

    [[http://llhx.nease.net/dnzx/index4.htm]]丰胸

    [[http://llhx.nease.net/dnzx/index6.htm]]疤痕

    [[http://llhx.nease.net/dnzx/index13.htm]]光子嫩肤

    [[http://llhx.nease.net/dnzx/index16.htm]]隆胸

    [[http://llhx.nease.net/dnzx/index20.htm]]瘦脸

    [[http://llhx.nease.net/dnzx/index21.htm]]瘦身

    [[http://llhx.nease.net/dnzx/index23.htm]]脱毛

    [[http://llhx.nease.net/dnzx/index36.htm]]整形美容

    [[http://llhx.nease.net/dnzx/index37.htm]]整形医院

    [[http://llhx.nease.net/dnzx/index38.htm]]美容医院

    [[http://app1.chinadaily.com.cn/static/cdyw/“>http://app1.chinadaily.com.cn/static/cdyw/]]翻译公司

    [[http://app1.chinadaily.com.cn/static/cdyw/“>http://app1.chinadaily.com.cn/static/cdyw/]]翻译

    [[http://www.farsight.com.cn/“>http://www.farsight.com.cn/]]嵌入式培训

    [[http://www.farsight.com.cn/“>http://www.farsight.com.cn/]]嵌入式

    [[http://www.maslink.com.cn/]]移民

    [[http://llhx.nease.net/gyz/]]肝移植

    [[http://www.kly88.cn/]]癫痫

    [[http://www.51jipiao.net/]]机票

    [[http://www.51jipiao.net/guoji.asp]]国际机票

    [[http://www.51jipiao.net/guonei.asp]]打折机票

    [[http://www.51jipiao.net/chanshi.html]]飞机票

    [[http://www.ocntrans.com/“>http://www.ocntrans.com/]]翻译公司

    [[http://www.ocntrans.com/“>http://www.ocntrans.com/]]翻译

    [[http://www.webcc.cn/]]虚拟主机

    [[http://www.18up.cn/indexsex.asp“>http://www.18up.cn/indexsex.asp]]成人用品

    [[http://www.18up.cn/indexsex.asp“>http://www.18up.cn/indexsex.asp]]性用品

    [[http://llhx.nease.net/tuozhan/index.htm]]拓展培训

    [[http://llhx.nease.net/tuozhan/index1.htm]]拓展训练

    [[http://llhx.nease.net/dhly/]]电话录音

    [[http://www.sh-dingyi.net/]]减速机

    [[http://www.sh-dejie.com/]]过滤材料

    [[http://hosting.vip.sina.com/dnwx/]]电脑维修

    [[http://hosting.vip.sina.com/yyjs/]]语音教室

    [[http://infoseek.vip.sina.com/dejie/]]过滤材料

    [[http://www.youanlivertx.com/]]肝移植

    [[http://www.shoes.hc360.com/]]鞋

    [[http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/]]java培训

    [[http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/]]软件工程师培训

    [[http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/]]测试工程师培训

    [[http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/“>http://www.topwise.cn/courses/dotnet.htm]].net培训

    [[http://www.hdkz.com.cn/]]印

    [[http://www.hdkz.com.cn/index1.htm]]北京印

    [[http://www.hdkz.com.cn/index1.htm]]刻

    [[http://www.hdkz.com.cn/index1.htm]]北京刻

    [[http://llhx.nease.net/hrly/]]怀柔旅游

    [[http://llhx.nease.net/zidianbing/index1.htm]]过敏性紫癜

    [[http://llhx.nease.net/zidianbing/index2.htm]]血小板减少

    [[http://llhx.nease.net/zidianbing/index3.htm]]复发性口腔溃疡

    [[http://www.hmkouqiang.com/]]口腔溃疡

    [[http://www.hmkouqiang.com/article/Article_Show.asp?ArticleID=25]]白塞氏

    [[http://www.hmkouqiang.com/article/Article_Show.asp?ArticleID=25]]白塞氏综合症

    [[http://www.hmkouqiang.com/article/Article_Class2.asp?ClassID=2]]白塞氏病

    [[http://www.zidianbing.com/]]紫癜

    [[http://www.hmkouqiang.com/article/Article_Class2.asp?ClassID=3]]口腔扁平苔藓

    [[http://www.hmkouqiang.com/article/Article_Class2.asp?ClassID=3]]扁平苔藓

    [[http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/]]服装批发

    [[http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/]]瑞丽服装批发

    [[http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/]]日韩服装批发

    [[http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/“>http://www.taobao168.com/]]珠宝首饰批发

    [[http://www.bjgelin.com/]]儿童摄影

    [[http://www.bjygmd.com/]]木雕

    [[http://www.lvsemayi.com/]]软水机

    [[http://www.olande.com/]]排队机

    [[http://llhx.nease.net/dnzx/index5.htm]]瘢痕

    [[http://llhx.nease.net/dnzx/index7.htm]]变形

    [[http://llhx.nease.net/dnzx/index8.htm]]抽脂

    [[http://llhx.nease.net/dnzx/index9.htm]]唇裂

    [[http://llhx.nease.net/dnzx/index10.htm]]处女膜修复

    [[http://llhx.nease.net/dnzx/index11.htm]]除皱

    [[http://llhx.nease.net/dnzx/index12.htm]]干细胞除皱

    [[http://llhx.nease.net/dnzx/index14.htm]]隆鼻

    [[http://llhx.nease.net/dnzx/index15.htm]]隆乳

    [[http://llhx.nease.net/dnzx/index17.htm]]毛发移植

    [[http://llhx.nease.net/dnzx/index18.htm]]去斑

    [[http://llhx.nease.net/dnzx/index19.htm]]雀斑

    [[http://llhx.nease.net/dnzx/index22.htm]]双眼皮

    [[http://llhx.nease.net/dnzx/index24.htm]]下颌角

    [[http://llhx.nease.net/dnzx/index25.htm]]吸脂

    [[http://llhx.nease.net/dnzx/index26.htm]]吸脂减肥

    [[http://llhx.nease.net/dnzx/index27.htm]]眼袋

    [[http://llhx.nease.net/dnzx/index28.htm]]腋臭

    [[http://llhx.nease.net/dnzx/index29.htm]]阴道紧缩

    [[http://llhx.nease.net/dnzx/index30.htm]]阴茎延长

    [[http://llhx.nease.net/dnzx/index31.htm]]注射丰胸

    [[http://llhx.nease.net/dnzx/index32.htm]]自体细胞除皱

    [[http://llhx.nease.net/dnzx/index33.htm]]整容价格

    [[http://llhx.nease.net/dnzx/index34.htm]]整容医院

    [[http://llhx.nease.net/dnzx/index35.htm]]整形价格

    [[http://llhx.nease.net/dnzx/index39.htm]]美容院

    [[http://llhx.nease.net/dnzx/index40.htm]]傲洛斯

    [[http://llhx.nease.net/dnzx/index41.htm]]欧菲斯

    [[http://llhx.nease.net/dnzx/index42.htm]]北京美容

    [[http://llhx.nease.net/dnzx/index43.htm]]北京美容医院

    [[http://llhx.nease.net/dnzx/index44.htm]]北京美容院

    [[http://llhx.nease.net/dnzx/index45.htm]]北京美容整形医院

    [[http://llhx.nease.net/dnzx/index46.htm]]北京整形

    [[http://llhx.nease.net/dnzx/index47.htm]]北京整形美容医院

    [[http://llhx.nease.net/dnzx/index48.htm]]北京整形医院

    [[http://llhx.nease.net/dnzx/index49.htm]]东南医院

    [[http://llhx.nease.net/dnzx/index50.htm]]东南整形

    [[http://llhx.nease.net/dnzx/index51.htm]]韩国整容

    [[http://llhx.nease.net/dnzx/index52.htm]]韩国整形

    [[http://yxnet.s9.xrea.com/chongqing/index.htm]]重庆机票

    [[http://yxnet.s9.xrea.com/chongqing/index2.htm]]重庆飞机票

    [[http://yxnet.s9.xrea.com/chongqing/index3.htm]]重庆打折机票

    [[http://yxnet.s9.xrea.com/chongqing/index4.htm]]重庆特价机票

    [[http://yxnet.s9.xrea.com/chongqing/index5.htm]]重庆国际机票

    [[http://yxnet.s9.xrea.com/chongqing/index6.htm]]重庆航班

    [[http://yxnet.s9.xrea.com/chongqing/index7.htm]]重庆航班时刻表

    [[http://yxnet.s9.xrea.com/chongqing/index8.htm]]重庆机票价格

    [[http://yxnet.s9.xrea.com/chongqing/index9.htm]]重庆机票查询

    [[http://yxnet.s9.xrea.com/chongqing/index10.htm]]重庆机票预订

    [[http://yxnet.s9.xrea.com/chongqing/index11.htm]]重庆飞机票价格

    [[http://yxnet.s9.xrea.com/chongqing/index12.htm]]重庆飞机票查询

    [[http://yxnet.s9.xrea.com/chongqing/index13.htm]]重庆飞机票预订

    [[http://yxnet.s9.xrea.com/chongqing/index14.htm]]重庆打折机票价格

    [[http://yxnet.s9.xrea.com/chongqing/index15.htm]]重庆打折机票查询

    [[http://yxnet.s9.xrea.com/chongqing/index16.htm]]重庆打折机票预订

    [[http://yxnet.s9.xrea.com/chongqing/index17.htm]]重庆国际机票价格

    [[http://yxnet.s9.xrea.com/chongqing/index18.htm]]重庆国际机票查询

    [[http://yxnet.s9.xrea.com/chongqing/index19.htm]]重庆国际机票预订

    [[http://yxnet.s9.xrea.com/chongqing/index20.htm]]重庆特价机票价格

    [[http://yxnet.s9.xrea.com/chongqing/index21.htm]]重庆特价机票查询

    [[http://yxnet.s9.xrea.com/chongqing/index22.htm]]重庆特价机票预订

    [[http://yxnet.s9.xrea.com/chongqing/index23.htm]]重庆国际航班

  3. 条形码 says:

    your site have a lot of issue,I will introduce to my good friends,Thx 🙂

    <a href="http://www.tiaoxingma.org&quot; target=_blank>条形码</a> <a href="http://www.tiaoxingma.org/news&quot; target=_blank>条形码新闻</a> <a href="http://www.bitian.com.cn&quot; target=_blank>条形码</a> <a href="http://www.bitian.com.cn/news&quot; target=_blank>条形码新闻</a> <a href="http://tiao-xing-ma.bizhat.com&quot; target=_blank>条形码</a> <a href="http://www.bitian.com.cn/sitemap.htm&quot;“>http://www.bitian.com.cn/sitemap.htm&quot; target=_blank>条形码地图</a> <a href="http://www.bitian.com.cn/bmap.htm&quot; target=_blank>条码地图</a> <a href="http://www.tiaoxingma.org/map.htm&quot; target=_blank>条形码地图</a> <a href="http://www.tiaoxingma.org/map2.htm&quot; target=_blank>条码地图</a> <a href="http://comsky.lqiang.com&quot; target=_blank>条形码</a> <a href="http://tiao-ma.bizhat.com&quot; target=_blank>条码</a> <a href="http://www.bitian.com.cn/projects/0.htm&quot; target=_blank>条形码方案</a> <A href="http://www.bitian.com.cn/sitemap.htm&quot;“>http://www.bitian.com.cn/sitemap.htm&quot; target=_blank>条形码地图1</A> <A href="http://www.bitian.com.cn/sitemap1.htm&quot; target=_blank>条形码地图2</A> <A href="http://www.bitian.com.cn/sitemap2.htm&quot; target=_blank>条形码地图3</A> <A href="http://www.bitian.com.cn/sitemap3.htm&quot; target=_blank>条形码地图4</A> <A href="http://www.bitian.com.cn/sitemap4.htm&quot; target=_blank>条形码地图5</A> <A href="http://www.bitian.com.cn/sitemap5.htm&quot; target=_blank>条形码地图6</A> <A href="http://www.bitian.com.cn/sitemap6.htm&quot; target=_blank>条形码地图7</A> <A href="http://www.bitian.com.cn/sitemap7.htm&quot; target=_blank>条形码地图8</A> <A href="http://www.bitian.com.cn/sitemap8.htm&quot; target=_blank>条形码地图9</A> <a href="http://www.bitian.com.cn/bmap2.htm&quot; target=_blank>条码地图2</a> <a href="http://www.bitian.com.cn/bmap3.htm&quot; target=_blank>条码地图3</a> <a href="http://www.bitian.com.cn/bmap4.htm&quot; target=_blank>条码地图4</a> <a href="http://11aa.zj.com&quot; target=_blank>条码打印机</a> <a href="http://cnbarcode.zj.com&quot; target=_blank>条码扫描仪</a> <a href="http://tiaomabt.zj.com&quot; target=_blank>条形码软件</a> <a href="http://sedai.zj.com&quot; target=_blank>条码色带</a> <a href="http://biaoqian.zj.com&quot; target=_blank>条码标签</a> <a href="http://tiaomaruanjian.zj.com&quot; target=_blank>条码软件</a> <a href="http://google11aa.zj.com&quot; target=_blank>条码</a> <a href="http://yahoo123.zj.com&quot; target=_blank>条形码方案</a> <a href="http://zomd.zj.com&quot; target=_blank>条码打印机</a> <a href="http://oohay.zj.com&quot; target=_blank>条码识读器</a> <a href="http://www.tiaoma.ful.cn&quot; target=_blank>条码识读器…</a>

    条形码产品专业供应商,条形码系统专业集成商,主营条形码打印机,条形码阅读器,数据采集器,条形码解决方案,条码编辑软件,Codesoft,Bartender,Loftware等软件