xoops123さあ、いっしょに XOOPS はじめましょう!

xoops123

うちのサイトでは、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 *}>

に変更。


新しくコメントをつける

題名
ゲスト名
投稿本文
より詳細なコメント入力フォームへ

トップ   凍結 差分 バックアップ 複製 名前変更 リロード印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
Counter: 3293, today: 1, yesterday: 0
初版日時: 2014-03-21 (金) 15:55:17
最終更新: 2014-03-21 (金) 16:01:38 (JST) (3651d) by marine