|
1: 2014-03-21 (金) 15:55:17 marine |
| + | TITLE:xugj_date で NEW 表示 |
| + | うちのサイトでは、XUGJ の 「Smarty小ネタ」 や 「XUGJ_date を作ろう」を参考に、投稿一覧表示の新規投稿にNew表示をする方法を採用しています。ここでは、その方法をご説明したいと思います。 |
| | | |
| + | ネタもとを参考にして、テーマの images フォルダに new01.gif と new02.gif をコピー、テーマ用の style.css に次の記述を加えて、altsys のテンプレート管理にて、該当するd3forum の forum_block_list_posts.html を編集・反映すると、記事投稿が24時間以内の場合は 赤い new01.gif ファイルが、7日以内は灰色の new02.gif が表示されるようになりました。 |
| + | |
| + | 当初、ネタもとの記事をそのまま適用したところ、NEW画像が記事表題の下に改行された状態で表示されたので、表題の頭にもっていって float:left 指定することにより、表題の頭に NEW画像が表示されるようになりました。 |
| + | |
| + | |
| + | style.css に下記内容を追加 |
| + | |
| + | span.new1 { |
| + | display:block; |
| + | width:27px; |
| + | height:10px; |
| + | background-image:url(images/new01.gif); |
| + | background-repeat: no-repeat; |
| + | text-indent:-9999px; |
| + | float:left; |
| + | } |
| + | span.new2 { |
| + | display:block; |
| + | width:30px; |
| + | height:11px; |
| + | background-image:url(images/new02.gif); |
| + | background-repeat: no-repeat; |
| + | text-indent:-9999px; |
| + | float:left; |
| + | } |
| + | |
| + | |
| + | d3forum の forum_block_list_posts.html を次のように編集・反映 |
| + | |
| + | <ol style=”padding:3px;margin:0;”> |
| + | <{foreach item=post from=$block.posts}> |
| + | <li style=”margin:1px;”><a href=”<{$block.mod_url}>/index.php?post_id=<{$post.id}>”><{$post.subject}></a> <{$post.uname}><{$post.post_time_formatted}> </li> |
| + | <{/foreach}> |
| + | </ol> |
| + | <{* $post.forum_id, $post.forum_title *}> |
| + | を |
| + | |
| + | <ol style=”padding:3px;margin:0;”> |
| + | <{foreach item=post from=$block.posts}> |
| + | <li style=”margin:1px;”><a href=”<{$block.mod_url}>/index.php?post_id=<{$post.id}>”><{$post.post_time_formatted|xugj_date:”"}><{$post.subject}></a> <{$post.uname}> </li> |
| + | <{/foreach}> |
| + | </ol> |
| + | <{* $post.forum_id, $post.forum_title *}> |
| + | に変更。 |
Counter: 3324,
today: 1,
yesterday: 0