CustomFieldsSearch のデモ

MT > CustomFieldsSearch
| | トラックバック(1)

フィールドとその内容

以下のようなフィールドで構成されています。

フィールド名内容タグ名タイプ
タイトル書名MTEntryTitleデフォルト
本文内容MTEntryBodyデフォルト
ISBNISBNbook_isbnテキスト
価格価格book_priceテキスト
出版社出版社book_pubドロップダウン
出版年出版年book_yearドロップダウン

登録されているエントリー一覧と検索フォームの例

以下のようなエントリーが登録されています。

検索フォームの意味

  • 「フリーワード」のテキスト入力欄にテキストを入力した場合、その下のチェックボックスの中でチェックしたカラムに対して一致が試みられます。
  • 「出版社」を指定して絞り込みを行うことができます。
  • 「出版年」を指定して絞り込みを行うことができます。この部分はORで条件を指定したことになります。
  • 「フリーワード」「出版社」「出版年」はAND検索になります。

検索フォーム部分のソース

<form method="get" action="<$mt:CGIPath$><$mt:SearchScript$>">
  <input type="hidden" name="CustomFieldsSearch" value="1" />
  <input type="hidden" name="CustomFieldsSearchClassType" value="entry" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryTitle" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryBody" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryMore" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryKeywords" />
  <input type="hidden" name="IncludeBlogs" value="<$mt:BlogID$>" />
  <fieldset id="freeword_set">
    <legend>フリーワード</legend>
    <input type="text" id="search_free" class="ti" name="search" value="<$mt:SearchString$>" />
    <br />
    <input type="checkbox" id="CustomFieldsSearchField_title" name="CustomFieldsSearchField" value="EntryTitle" />
    <label for="CustomFieldsSearchField_title">: 書名</label>
    <input type="checkbox" id="CustomFieldsSearchField_text" name="CustomFieldsSearchField" value="EntryBody" />
    <label for="CustomFieldsSearchField_text">: 内容</label>
    <input type="checkbox" id="CustomFieldsSearchField_book_isbn" name="CustomFieldsSearchField" value="book_isbn" />
    <label for="CustomFieldsSearchField_book_isbn">: ISBN</label>
    <input type="checkbox" id="CustomFieldsSearchField_book_price" name="CustomFieldsSearchField" value="book_price" />
    <label for="CustomFieldsSearchField_book_price">: 価格</label>
  </fieldset>
  <fieldset>
    <legend>出版社</legend>
    <select name="CustomFieldsSearchFieldLike">
      <option value="">指定なし</option>
      <option value="book_pub:インプレスジャパン"> インプレスジャパン</option>
      <option value="book_pub:ソフトバンククリエイティブ"> ソフトバンククリエイティブ</option>
      <option value="book_pub:オライリージャパン"> オライリージャパン</option>
    </select>
  </fieldset>
  <fieldset>
    <legend>出版年</legend>
    <input type="checkbox" id="CustomFieldsSearchFieldIn_book_year_2004" name="CustomFieldsSearchFieldIn" value="book_year:2004" />
    <label for="CustomFieldsSearchFieldIn_book_year_2004">: 2004年</label>
    <input type="checkbox" id="CustomFieldsSearchFieldIn_book_year_2008" name="CustomFieldsSearchFieldIn" value="book_year:2008" />
    <label for="CustomFieldsSearchFieldIn_book_year_2008">: 2008年</label>
  </fieldset>
  <input type="hidden" name="limit" value="2" />
  <input type="submit" accesskey="4" value="検索" />
  <input type="hidden" name="CustomFieldsSearchLuckyArchiveType" value="Individual" />
  <input type="submit" name="CustomFieldsSearchLucky" accesskey="5" value="I'm Feeling Lucky" />
</form>

検索結果表示でのMTIfCustomFieldsSearchFieldの使用例

<mt:IfCustomFieldsSearchField tag="book_isbn">
<!-- ISBNが検索対象になっている場合にのみ表示されます -->
ISBN: <MTbook_isbn>
</mt:IfCustomFieldsSearchField>

<mt:IfCustomFieldsSearchField tag="book_price">
<!-- 価格が検索対象になっている場合にのみ表示されます -->
価格: <MTbook_price>
</mt:IfCustomFieldsSearchField>

トラックバック(1)

このブログ記事を参照しているブログ一覧: CustomFieldsSearch のデモ

このブログ記事に対するトラックバックURL: https://tec.toi-planning.net/mtos/mt-tb.cgi/390

» fieldset-でつながるブログリング(blogring.org)~のトラックバック

fieldsetに関するブログをまとめています。 続きを読む