Re: 画像掲示板の一覧表で詳細の文字列を丸める

このトピックの投稿一覧へ

なし Re: 画像掲示板の一覧表で詳細の文字列を丸める

msg# 1.1.1.1
depth:
3
前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2024/2/11 10:20 | 最終変更
タツ  管理人   投稿数: 2403 オンライン
今さらですが、前回に続き、画像掲示板でログインして一覧表を表示すると記事が丸められなくなり、記事全てが表示されるのが気になり修正することにしました。今回はテンプレートを1つ追加することによってログインの如何に関わらず編集、追加のプレビューではすべてを表示し、一覧表では丸めて表示するという方法です。

具体的には、前回の'sdescription' を利用することは同じですが、myalbum_photo_in_list.htmと新たにmyalbum_photo_in_list_sというテンプレートを作り、使い分けることとしました。

■新たなテンプレートを作成する
1.myalbumモジュールのtemplatesフォルダのmyalbum_photo_in_list.htmlをコピーし、名前を変更し新たにmyalbum_photo_in_list_s.htmlを作成します。

2.これは意味があるのか定かではありませんが、同じくmyalbumモジュールのtemplatesフォルダmk_template.shのファイルに以下のコードを追加します。
cp -a myalbum_photo_in_lists.html myalbum$1_photo_in_list_s.html

3.myalbumモジュールのxoops_version.phpの// Templatesの場所に以下を追加します
$modversion['templates'][12]['file'] = "myalbum{$mydirnumber}_photo_in_list_s.html" ;
$modversion['templates'][12]['description'] = '';

4.システム設定のモジュール管理にてmyalbumモジュールのアップデートを行います。(オリジナルのテンプレートを利用していると変更する場合があるので注意が必要です。)

■テンプレートの変更
以上でテンプレートmyalbum_photo_in_list_s.htmlが追加されます。myalbum_photo_in_list.htmlとmyalbum_photo_in_list_s.htmlのテンプレート内容は同一にし、以下の部分だけを変更します。

1.myalbum_photo_in_list.htmlのテンプレート
<{* DESCRIPTION *}>
<{if $photo.description}>
<table border='0' cellpadding='0' cellspacing='0' width='100%' class='outer'>
<tr>
<td class='odd'>
<{if $photo.description}>
<{$photo.description}>
<{/if}>
</td>
</tr>
</table>
<{/if}>

2.myalbum_photo_in_list_s.htmのテンプレート
<{* DESCRIPTION *}>
<{if $photo.description}>
<table border='0' cellpadding='0' cellspacing='0' width='100%' class='outer'>
<tr>
<td class='odd'>
<{if $photo.description}>
<{$photo.sdescription}>
<{/if}>
</td>
</tr>
</table>
<{/if}>

さらに
3.myalbum_viewcat_list.htmlのテンプレートで
db:myalbum_photo_in_list.htm → db:myalbum_photo_in_list_s.htm

4.myalbum_index.htmlのテンプレートで
db:myalbum_photo_in_list.htm → db:myalbum_photo_in_lists.htm

これでログインするしないに関わらず一覧表では記事が丸められて表示されるようになりました。
投票数:2 平均点:5.00

投稿ツリー


     条件検索へ

旅と気ままなフォーラム最新投稿

欲しい商品が必ず見つかるメジャーなネットショップ

ログイン

Facebook,RSSリンク表示

検索

アクセスカウンタ

今日 : 172
昨日 : 254
総計 : 1631164