エントリー

freoのサイドメニューのカテゴリーをセレクトメニューで表示する

デフォルトではリスト表示になっているカテゴリーの表示ですが、これをセレクトメニューで表示する方法です。
ファイル 70-1.jpg ファイル 70-2.jpg

  1. templates/utility_category.html
    <!--{foreach from=$freo.refer.categories|smarty:nodefaults item='refer_category'}-->
      <!--{if $refer_category.pid == $pid and $refer_category.display == 'publish'}-->
      <!--{php}if (!$flag) :{/php}--><ul><!--{php}endif;{/php}-->
      <li>
        <a href="{$freo.core.http_file}/category/{$refer_category.id}">{$refer_category.name}</a>({$plugin_category_counts[$refer_category.id]|default:0})
        <!--{assign var="pid" value=$refer_category.id}-->
          {include file='utility_category.html'}
        <!--{assign var="pid" value=$refer_category.pid}-->
      </li>
      <!--{php}$flag = 1;{/php}-->
      <!--{/if}-->
    <!--{foreachelse}-->
    <ul>
      <li>カテゴリーが登録されていません。</li>
    </ul>
    <!--{/foreach}-->
    <!--{php}if ($flag) :{/php}--></ul><!--{php}endif;{/php}-->

    の部分を、

    <!--{foreach from=$freo.refer.categories|smarty:nodefaults item='refer_category'}-->
      <!--{if $refer_category.pid == $pid and $refer_category.display == 'publish'}-->
      <option value="{$freo.core.http_file}/category/{$refer_category.id}">{if $refer_category.pid}  {/if}{$refer_category.name}({$plugin_category_counts[$refer_category.id]|default:0})</option>
      <!--{assign var="pid" value=$refer_category.id}-->
        {include file='utility_category.html'}
      <!--{assign var="pid" value=$refer_category.pid}-->
      <!--{/if}-->
    <!--{foreachelse}-->
      <option>カテゴリーが登録されていません。</option>
    <!--{/foreach}-->
    に変更(緑字を削除して赤字を追加)ます。
  2. templates/utility.html の40~45行目あたりの
    <div class="utility">
      <h3>カテゴリー</h3>
      <div class="content">
        {include file='utility_category.html'}
      </div>
    </div>

    の部分を、

    <div class="utility">
      <h3>カテゴリー</h3>
      <div class="content">
        <select onchange="location.href=this.options[this.selectedIndex].value">
        <option value="">カテゴリーを選択</option>
          {include file='utility_category.html'}
        </select>
      </div>
    </div>
    に変更(赤字を追加)します。

ページ移動

関連エントリー

コメント

  • コメントはまだありません。

コメント登録

  • コメントを入力してください。
  • 一旦登録したコメントは、あとで編集できませんのでご注意下さい。
登録フォーム

基本的には「全体に公開」されますが、内容によっては管理人の方で公開を制限する場合がありますので、その旨ご了承下さい。

ユーティリティ

2024年03月

- - - - - 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 - - - - - -

キーワード検索

キーワード検索フォーム

ユーザー

  • cccのアバター

新着画像

ブログパーツ

Twitter

Twilogを見る

Feed