やりたいこと
MT7の記事ページについて、『カテゴリ』『月別アーカイブ』『キーワード』で同時に絞り込み検索をできるようにしたい。
月別アーカイブについてはもともとある機能をそのまま使用するのが難しそうなので、
カテゴリで疑似的にアーカイブを作成して対応しようと思っています。
「お知らせ(カテゴリ)」「2020年1月(月別アーカイブ・カテゴリで作成)」「ほげ(キーワード)」で検索、という感じです。
環境
Movable Type7
テンプレート『Eiger 1.6』
プラグイン『CategorySearch』を使用
:http://tec.toi-planning.net/mt/categorysearch/
試したこと
下記のページを参考に、【テンプレート > 検索】ウィジェットを編集しました。
https://nandani.sakura.ne.jp/web_all/javascript/1106/
ただ、セレクトボックスの仕様では想定のデザインを実現できないため、
inputで代用できないかと思って変更したところ、うまく行きません…。
また、カテゴリは『カテゴリ』『月別アーカイブ』の2種類でデザインが異なるため、
出力を分けることもしたいです。
html
1<script type="text/javascript"> 2function searchTextCheck(){ 3 var searchText = document.getElementById("searchText").value; 4 if(searchText != ""){ 5 document.getElementById("CategorySearchIgnoreText").value = "0"; 6 } 7} 8</script> 9<nav class="widget-search widget"> 10 <form method="get" action="<$mt:CGIPath$><$mt:SearchScript$>"> 11 12 <MTTopLevelCategories> 13 <MTSetVarBlock name="tcid"><MTCategoryID></MTSetVarBlock> 14 <input type="hidden" name="CategorySearchSets" value="<MTCategoryID>" /> 15 <ul class="category"> 16 <MTIf name="selected"> 17 <li class="category_item"> 18 <input type="radio" name="radiobutton" id="<MTCategoryID>" value="<MTCategoryLabel>" selected="selected"> 19 <label for="<MTCategoryID>">すべての<MTCategoryLabel></label></li> 20 <MTElse> 21 <li class="category_item"> 22 <input type="radio" name="radiobutton" id="<MTCategoryID>" value="<MTCategoryLabel>"> 23 <label for="<MTCategoryID>">すべての<MTCategoryLabel></label></li> 24 </MTIf> 25 <MTSubCategories> 26 <MTSetVarBlock name="clabel"><MTCategoryLabel></MTSetVarBlock> 27 <MTCategorySearchLink type="absolute" set="$tcid" value="$clabel" op="replace" text="ignore" > 28 <MTIf name="selected"> 29 <li class="category_item"> 30 <input type="radio" name="radiobutton" id="<MTCategoryID>" value="<MTCategoryLabel>" selected="selected"> 31 <label for="<MTCategoryID>"><MTCategoryLabel></label></li> 32 <MTElse> 33 <li class="category_item"> 34 <input type="radio" name="radiobutton" id="<MTCategoryID>" value="<MTCategoryLabel>"> 35 <label for="<MTCategoryID>"><MTCategoryLabel></label></li> 36 </MTIf> 37 </MTCategorySearchLink> 38 </MTSubCategories> 39 </ul> 40 </MTTopLevelCategories> 41 42 <div> 43 <input type="text" name="search" id="searchText" value="<$mt:SearchString$>" onkeypress="searchTextCheck();" /> 44 <input type="hidden" name="CategorySearch" value="1" /> 45 <input type="hidden" name="CategorySearchIgnoreText" id="CategorySearchIgnoreText" value="1" /> 46 <input type="hidden" name="IncludeBlogs" value="<$mt:BlogID$>" /> 47 <input type="hidden" name="limit" value="<$mt:SearchMaxResults$>" /> 48 <input type="submit" accesskey="4" value="検索" onclick="searchTextCheck();" onkeypress="searchTextCheck();" /> 49 </div> 50 51</form> 52</nav> 53
他にいいプラグインや方法があれば教えていただきたいです…
お知恵をお借りしたく思います。
何卒よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。