• 虹色ミツバチ
  • freoカスタマイズメモ、テンプレート・プラグイン配布/officeTIPS
検索プラグイン
虹色ミツバチ

> Entry >freo>freoTips>プラグイン系TIPS> サークル管理プラグインでサークルカップリングクラウド表示プラグインを利用してサークルをカップリング別に一覧表示する方法

【freo】【freoTips】【プラグイン系TIPS】サークル管理プラグインでサークルカップリングクラウド表示プラグインを利用してサークルをカップリング別に一覧表示する方法

freo公式サイトで配布されているサークル管理プラグインでは、登録されたサークルがサークル名順に一覧表示されるようになっています。
これを残したまま、サークルをカップリング別(同カップリング内ではサークル名順)に表示することができるようにしてみます。

サンプル

当サイトが利用しているfreoユーザーリンク集サークル管理プラグインを利用していますが、本リンク集でもこのTIPSを利用しています。
本リンク集にカップリング別表示メニュー(当サイトではサークル管理プラグインの「カップリング」を「ジャンル」として利用しています。)がありますので、そちらをご覧下さい。

サークルをカップリング別に一覧表示してみる。

本リンク集にあるカップリング順表示メニューでは、カップリング別に表示させた上で、カップリング名も表示させています。

  1. サークルカップリングクラウド表示プラグインを実装する。
  2. サークルカップリング表示プラグインの[freo/libs/freo/plugins/config.circle_couplingcloud.php]の21行目(display設定)
    define('FREO_PLUGIN_CIRCLE_COUPLINGCLOUD_LOAD_DISPLAY', 'circle/default,circle/coupling,circle/view');
    
    に変更する。
  3. [freo/templates/plugins/circle/default.html]をコピーして同階層にペーストし、[freo/templates/plugins/circle/coupling.html]にリネームする。
  4. [freo/templates/plugins/circle/coupling.html]の11~44行目のサークル情報表示部分をまるっと変更してしまいます。
    <!--{foreach from=$plugin_circle_couplingclouds|smarty:nodefaults item='plugin_circle_couplingcloud'}-->
        <h3>{$plugin_circle_category.name}</h3>
        <table summary="サークル">
            <thead>
                <tr>
                    <th>サークル名</th>
                    <th>サークル代表者名</th>
                    <th>カテゴリー</th>
                    <th>タグ</th>
                    <th>登録日時</th>
                    <th>更新日時</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th>サークル名</th>
                    <th>サークル代表者名</th>
                    <th>カテゴリー</th>
                    <th>タグ</th>
                    <th>登録日時</th>
                    <th>更新日時</th>
                </tr>
            </tfoot>
            <tbody>
                <!--{foreach from=$plugin_circles|smarty:nodefaults item='plugin_circle'}-->
                    <!--{if $plugin_circle_couplingcloud.coupling == $plugin_circle.coupling}-->
                        <tr>
                            <td><a href="{$freo.core.http_file}/circle/view/{$plugin_circle.user_id}">{$plugin_circle.name}</a></td>
                            <td>{$plugin_circle.owner_name}</td>
                            <td><!--{if $plugin_circle.category_id}--><a href="{$freo.core.http_file}/circle?category={$plugin_circle.category_id}">{$plugin_circle_categories[$plugin_circle.category_id].name}</a><!--{/if}--></td>
                            <td><!--{foreach from=$plugin_circle_tags[$plugin_circle.user_id]|smarty:nodefaults item='plugin_circle_tag' name='loop'}--><a href="{$freo.core.http_file}/circle?tag={$plugin_circle_tag|smarty:nodefaults|escape:'url'}">{$plugin_circle_tag}</a><!--{if !$smarty.foreach.loop.last}-->,&nbsp;<!--{/if}--><!--{/foreach}--></td>
                            <td><!--{if $plugin_circle.created|date_format:'%Y%m%d' == $smarty.now|date_format:'%Y%m%d'}-->{$plugin_circle.created|date_format:'%H:%M:%S'}<!--{else}-->{$plugin_circle.created|date_format:'%Y/%m/%d'}<!--{/if}--></td>
                            <td><!--{if $plugin_circle.modified|date_format:'%Y%m%d' == $smarty.now|date_format:'%Y%m%d'}-->{$plugin_circle.modified|date_format:'%H:%M:%S'}<!--{else}-->{$plugin_circle.modified|date_format:'%Y/%m/%d'}<!--{/if}--></td>
                        </tr>
                    <!--{/if}-->
                <!--{/foreach}-->
            </tbody>
        </table>
    <!--{/foreach}-->
  5. [freo/templates/plugins/circle/coupling.html]をアップロードする。

解説するとこんな感じです

<!--{サークルのカップリングを繰り返して表示するここから}-->
    <h3>カップリング名</h3>
    <table summary="サークル">
        <thead>
            <tr>
                サークル表示項目名(省略)
            </tr>
        </thead>
        <tfoot>
            <tr>
                サークル表示項目名(省略)
            </tr>
        </tfoot>
        <tbody>
            <!--{サークルの情報を繰り返して表示するここから}-->
                <!--{もし表示しているカップリング名がサークルのカップリングと同じだったらここから}-->
                    <tr>
                        サークルの情報(省略)
                    </tr>
                <!--{もし表示しているカップリング名がサークルのカップリングと同じだったらここまで}-->
            <!--{/サークルの情報を繰り返して表示するここまで}-->
        </tbody>
    </table>
<!--{サークルのカップリングを繰り返して表示するここまで}-->

ここまでで、[freo/index.php/circle/coupling]にアクセスすると、サークルがカップリング別(同カップリング内ではサークル名順)に表示されるはずです。

ページ移動

関連記事

ページ上部へ