2010年6月21日月曜日

できたー MT5でカテゴリとカスタムフィールド検索を組み合わせる方法

これと
http://www.7dc.jp/matsutsune/2009/11/customfields.html

これだ!
http://tec.toi-planning.net/mt/customfieldssearch/

つかれた。。

ソース
<form method="get" action="<$mt:CGIPath$><$mt:SearchScript$>">
<!--カスタムフィールドサーチを有効にするかどうか-->
<input type="hidden" name="CustomFieldsSearch" value="1" />

<!--どのブログを検索対象にするか-->
<input type="hidden" name="IncludeBlogs" value="<$mt:BlogID$>" />

<!--カテゴリサーチを有効にするかどうか-->
<input type="hidden" name="CategorySearch" value="1" />
<input type="hidden" name="CategorySearchSets" value="1" />

<!--カテゴリ選択用プルダウン select nameが”1”なのがポイントっぽい-->
<select name="1">
<option value="0">--</option>
<MTTopLevelCategories>
<MTSubCatIsFirst>MTSubCatIsFirst><MTIfNonZero tag="MTCategoryCount">
<option value=""><$MTCategoryLabel$> [<$MTCategoryCount$>]</option>
MTIfNonZero><MTSubCatsRecurse><MTSubCatIsLast>MTSubCatIsLast>
MTTopLevelCategories>
select>
<fieldset id="freeword_set">
<br />
<!---->

<!--カスタムフィールドがチェックボックスのものを検索する場合
チェック有り無しは「なし:0、あり:1」で出力されるので-->
<!-- valueを -->
カスタムフィールドの値がチェックボックスのもので、チェックがついたエントリーをOR検索<br/>
<input type="checkbox" id="CustomFieldsSearchField_
entryninjin" name="CustomFieldsSearchFieldIn" value="entryninjin:1" />
<label for="CustomFieldsSearchField_entryninjin">: にんじん</label>
<input type="checkbox" id="CustomFieldsSearchFieldIn_
entrypiman" name="CustomFieldsSearchFieldIn" value="entrypiman:1" />
<label for="CustomFieldsSearchFieldIn_
entrypiman">: ピーマン</label>
<input type="checkbox" id="CustomFieldsSearchField_
entrysweetpotato" name="CustomFieldsSearchFieldIn" value="entrysweetpotato:1" />
<label for="CustomFieldsSearchField_
entrysweetpotato">: さつまいも</label>
fieldset>



<input type="submit" accesskey="4" value="検索" />
form>

0 件のコメント:

コメントを投稿