サポート
プロフィールのカテゴリ別表示について
aki (2016/05/26 02:59)
設置URL : http://www.google.jp/
プロフィール拡張プラグインを利用した際に利用できるプロフィール一覧ページの並び順をカテゴリ別にしたいのですが、どうすれば良いでしょうか。
http://freo.jp/support/view/682
この方の方法を応用すればできるのかな、と思うのですが、php初心者のためわかりませんでした。
どなたかご助言頂けませんでしょうか。
宜しくお願いいたします。
ccc (2016/05/26 20:53)
URL : http://cccabinet.jpn.org/
カテゴリーID順でよろしければ...
http://ameblo.jp/webmage/entry-11118798543.html
を参考にmodifier.sortby.phpを作成して、それをlibs/smarty/pluginsフォルダに入れます。
templates/plugins/profile/default.htmlの31行目あたりの
<!--{foreach from=$plugin_profiles|smarty:nodefaults item='plugin_profile'}-->の部分を
<!--{foreach from=$plugin_profiles|smarty:nodefaults|@sortby:'#category_id' item='plugin_profile'}-->にします。
「#category_id」にすれば昇順、「-category_id」にすれば降順になります。
カテゴリー名順となると「category_id」の部分の表記方法がちょっと思い浮かびませんm(__)m
aki (2016/05/27 00:02)
cccさん、ありがとうございます。
私の文章の書き方が悪く申し訳ありません。
カテゴリ名
プロフィール
プロフィール
プロフィール
カテゴリ名
プロフィール
プロフィール
プロフィール
というように表示したいので、指定したカテゴリのプロフィールのみを抜き出したいのです。
何度も申し訳ありませんが、わかる方、宜しくお願いいたします。
ミツ (2016/05/27 19:07)
URL : http://32877.xii.jp
こんにちは。
プロフィールプラグイン実装後、[freo/index.php/profile]画面にアクセスすると、登録されているプロフィールが一覧表示されます。
また、[freo/templates/plugins/profile/default.html]の10行目と11行めの間などに
<!--{foreach from=$plugin_profile_categories|smarty:nodefaults item='plugin_profile_category'}-->
<h3>{$plugin_profile_category.name}</h3>
<!--{/foreach}-->のように記載すると、プロフィールのカテゴリーを一覧表示できます。
これを利用して、[freo/templates/plugins/profile/default.html]の11行目~41行目を
<!--{foreach from=$plugin_profile_categories|smarty:nodefaults item='plugin_profile_category'}-->
<h3>{$plugin_profile_category.name}</h3>
<table summary="プロフィール">
<thead>
<tr>
<th>ID</th>
<th>名前</th>
<th>フリガナ</th>
<th>カテゴリー</th>
<th>タグ</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>名前</th>
<th>フリガナ</th>
<th>カテゴリー</th>
<th>タグ</th>
</tr>
</tfoot>
<tbody>
<!--{foreach from=$plugin_profiles|smarty:nodefaults item='plugin_profile'}-->
<!--{if $plugin_profile_category.id == plugin_profile.category_id}-->
<tr>
<td><a href="{$freo.core.http_file}/profile/{$plugin_profile.user_id}">{$plugin_profile.user_id}</a></td>
<td>{$users[$plugin_profile.user_id].name}</td>
<td>{$plugin_profile.kana}</td>
<td><!--{if $plugin_profile.category_id}--><a href="{$freo.core.http_file}/profile?category={$plugin_profile.category_id}">{$plugin_profile_categories[$plugin_profile.category_id].name}</a><!--{/if}--></td>
<td><!--{foreach from=$plugin_profile_tags[$plugin_profile.user_id]|smarty:nodefaults item='plugin_profile_tag' name='loop'}--><a href="{$freo.core.http_file}/profile?tag={$plugin_profile_tag|smarty:nodefaults|escape:'url'}">{$plugin_profile_tag}</a><!--{if !$smarty.foreach.loop.last}-->, <!--{/if}--><!--{/foreach}--></td>
</tr>
<!--{/if}-->
<!--{/foreach}-->
</tbody>
</table>
<!--{/foreach}-->のようにすると、カテゴリーごとのプロフィールを一覧表示できます。
なお、この時のカテゴリーは、カテゴリーの並び順で表示されます。
返信
- この記事に返信します。
- 返信の際は、設置URL以外の項目は入力必須です。