17-3 検索結果のページ分割をカスタマイズする
319ページ
「検索結果」システムテンプレート(検索結果の見出しに「現在のページ/総ページ数」を表示する)
...前略...
<div id="search-results">
<span id="current-page" class="hidden"><$mt:CurrentPage$></span>
<h1 id="page-title" class="search-results-header">
<mt:IfStraightSearch>
「<$mt:SearchString$>」と一致するもの
</mt:IfStraightSearch>
<mt:IfTagSearch>
タグ「<$mt:SearchString$>」が付けられているもの
</mt:IfTagSearch>
<mt:if tag="TotalPages" ne="1">(<mt:CurrentPage />/<mt:TotalPages />)</mt:if>
</h1>
...後略...
320ページ
「検索結果」システムテンプレート(検索結果が1ページだけのときに「1」という表示をなくす)
...前略...
<mt:PagerBlock>
<mt:GetVar name="__value__" setvar="result_number" />
</mt:PagerBlock>
<mt:unless name="result_number" eq="1">
<div class="content-nav">
<mt:IfPreviousResults><a href="<$mt:PreviousLink$>" rel="prev" onclick="return swapContent(-1);">< 前</a> </mt:IfPreviousResults><mt:PagerBlock><mt:IfCurrentPage><$mt:Var name="__value__"$><mt:Else><a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a></mt:IfCurrentPage><mt:Unless name="__last__"> </mt:Unless></mt:PagerBlock><mt:IfMoreResults> <a href="<$mt:NextLink$>" rel="next" onclick="return swapContent();">次 ></a></mt:IfMoreResults>
</div>
</mt:unless>
...後略...
「検索結果」システムテンプレート(ページナビゲーションを上部に表示する)
...前略...
<h1 id="page-title" class="search-results-header">
<mt:IfStraightSearch>
「<$mt:SearchString$>」と一致するもの
</mt:IfStraightSearch>
<mt:IfTagSearch>
タグ「<$mt:SearchString$>」が付けられているもの
</mt:IfTagSearch>
</h1>
<div class="content-nav">
<mt:IfPreviousResults><a href="<$mt:PreviousLink$>" rel="prev" onclick="return swapContent(-1);">< 前</a> </mt:IfPreviousResults><mt:PagerBlock><mt:IfCurrentPage><$mt:Var name="__value__"$><mt:Else><a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a></mt:IfCurrentPage><mt:Unless name="__last__"> </mt:Unless></mt:PagerBlock><mt:IfMoreResults> <a href="<$mt:NextLink$>" rel="next" onclick="return swapContent();">次 ></a></mt:IfMoreResults>
</div>
<div class="search-results-container autopagerize_page_element">
...後略...
321ページ
「検索結果」システムテンプレート(ページナビゲーションをプルダウンメニューにする)
...前略...
<script type="text/javascript">
//<![CDATA[
function selectUrl(sel){
if(sel.options[sel.selectedIndex].value){
location.href = sel.options[sel.selectedIndex].value;
}
}
//]]>
</script>
<div class="content-nav">
<mt:ifPreviousResults>
<a href="<mt:PreviousLink />" rel="prev" onclick="return swapContent(-1);">< 前</a>
</mt:ifPreviousResults>
<form action="javascript:void()" style="display:inline">
<select name="select" onChange="selectUrl(this.form.select)">
<mt:PagerBlock>
<mt:ifCurrentPage>
<option value="<mt:PagerLink>" selected="selected"><mt:GetVar name="__value__" /></option>
<mt:else>
<option value="<mt:PagerLink>"><mt:GetVar name="__value__" /></option>
</mt:ifCurrentPage>
<mt:unless name="__last__"> </mt:unless>
</mt:PagerBlock>
</select>
</form>/<mt:TotalPages />ページ
<mt:ifMoreResults>
<a href="<mt:NextLink />" rel="next" onclick="return swapContent();">次 ></a>
</mt:ifMoreResults>
</div>
...後略...