パーソナルツール
現在の場所: ホーム takalog plone サイトを firefox の検索プラグインに対応させる
書いた本
Plone 完全活用ガイド の Chapter 1, 2, 3, 11 を執筆しました。
plone のインストール、使い方から、機能・デザインのカスタマイズ、プロダクトの作り方まで、 plone のすべてがぎゅっと詰まっている書籍になっていると思います。
plone に興味がある人から、すでに使いこなしている方まで、ぜひ読んでみてください。
Plone 完全活用ガイドのサポートページ
« 2012May »
Su Mo Tu We Th Fr Sa
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
このBlogについて
鈴木たかのりです。とりあえず日記っぽく雑多なことを書き込んでいこうと思っています。 zope/plone関係の技術的な内容については http://takanory.net の方にまとめていこうと思います。 コメント・ツッコミはご自由にどうぞ。
twitter facebook linkedin foursquare
カテゴリ
android (16)
av (27)
books (35)
coreblog (49)
ds (22)
emacs (8)
ferret (24)
google (34)
icecream (44)
lego (70)
mac (22)
misc (74)
moblog (277)
movie (33)
pc (44)
plone (338)
puzzle (42)
python (57)
server (67)
snowscoot (9)
software (125)
sports (32)
suidou (30)
winds (47)
 
文書操作

plone サイトを firefox の検索プラグインに対応させる

作成者 takanori投稿日 2007年01月06日 14時36分 最終変更日時 2007年01月06日 14時43分
検索プラグインなし
検索プラグインあり
検索プラグインを追加

このサイトを firefox の検索プラグインに対応させました。

firefox 2.0 では、検索プラグインが提供されいるページとされていないページでは、検索窓の表示が変わります。

上にある2つの画像を見比べてください。「検索プラグインあり」の場合は Google アイコンのまわりが青くなっています。

で、この青くなっているときは「このサイトに検索プラグインがありますよ」ってお知らせなので、ここをぽちっと押すと 「検索プラグインを追加」のようなものが表示されて、検索プラグインが追加できます。

検索プラグインを追加すると、いつでもこのサイトが firefox の検索ボックスから検索できるようになります。 (必要ない?)

やり方は以下のとおりです。

まず最初に検索方法を示す xml ファイルを作成します。

ZMI で portal_skins/custom に移動して、Page Templatesearch.xml というアイテムを作成します。

中身はこんな感じ。:

  <?xml version="1.0" encoding="utf-8"?>
  <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                         xmlns:moz="http://www.mozilla.org/2006/browser/search/"
                         xmlns:tal="http://xml.zope.org/namespaces/tal">
    <ShortName tal:content="context/title">Title</ShortName>
    <Description tal:content="string:${context/title}をサイト内検索">Search this site</Description>
    <InputEncoding>utf-8</InputEncoding>
    <Url type="text/html" method="GET" template=""
         tal:attributes="template string:${context/portal_url}/search?SearchableText={searchTerms}" />
  </OpenSearchDescription>

もう一つ、せっかくなので google で検索するバージョンも作ります。名前は search_google.xml にしておきます。:

  <?xml version="1.0" encoding="utf-8"?>
  <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                         xmlns:moz="http://www.mozilla.org/2006/browser/search/"
                         xmlns:tal="http://xml.zope.org/namespaces/tal">
    <ShortName tal:content="string:${context/title}(Google)">Title</ShortName>
    <Description tal:content="string:${context/title}(Google)">Search this site</Description>
    <InputEncoding>utf-8</InputEncoding>
    <Url type="text/html" method="GET" template=""
         tal:define="inurl python:context.portal_url().replace('http://', '')"
         tal:attributes="template string:http://www.google.co.jp/search?q={searchTerms}&amp;hl=ja&amp;ie=utf-8&amp;oe=utf-8&amp;hq=inurl:${inurl}" />
  </OpenSearchDescription>

これらのコードは下にはってあるのでよかったらお使いください。

で、最後に portal_skins/plone_templates/header をカスタマイズして、検索プラグインがあることをヘッダに書きます。

私の場合はコードのこの部分の下に追加しました。:

    <link rel="up" href="" title="Up one level"
          tal:define="parent python:here.navigationParent(here, template_id)"
          tal:condition="parent"
          tal:attributes="href parent" />

検索プラグインのありかを教えるコードはこんな感じです。:

    <link rel="search" type="application/opensearchdescription+xml" title="" href=""
          tal:attributes="href string:${portal_url}/search.xml;
                          title string:${portal_title}">

    <link rel="search" type="application/opensearchdescription+xml" title="" href=""
          tal:attributes="href string:${portal_url}/search_google.xml;
                          title string:${portal_title}(Google)">

なお、検索プラグインを作るときに参考にしたのは以下のページです。

  • 検索用ファイル 検索用ファイル
  • サイズ 1 kB - File type text/xml
  • 検索用ファイル(Google検索) 検索用ファイル(Google検索)
  • サイズ 1 kB - File type text/xml
    カテゴリ
    plone plone
    software software
    トラックバック用URL:
    http://takanory.net/takalog/649/tbping
    コメントを追加

    下のフォームに記入してコメントを追加できます。平文テキスト形式。

    (必須)
    (必須)
    (必須)
    (Required)
    Enter the word

    Powered by vine linux, python, zope, plone, coreblog