LoginSignup
0

More than 5 years have passed since last update.

d3forumの「参考にならない」ボタンが好きではないので、「いいね!」ボタンだけを表示するようにしてみた。

Last updated at Posted at 2013-04-20

基本的には、テーマのテーマ下テンプレートとして、d3forumのテンプレート inc_eachpost.html などを編集することで対応することを想定、もちろん、オリジナルのテンプレートを修正するのもOK。(その場合は、altsysを使った方法が良いかも)

d3forumのテーマ下テンプレート inc_eachpost.html について次のような編集を行う。

101行目あたりの

<span class="d3f_vote">
    <{$smarty.const._MD_D3FORUM_VOTECOUNT}>:<{$post.votes_count}>
    <{$smarty.const._MD_D3FORUM_VOTEPOINTAVG}>:<{$post.votes_avg|string_format:"%.2f"}>
</span>

を削除するかコメントアウトする。

116行目あたりの

<form action="<{$mod_url}>/index.php" method="get" style="display:inline;">
    <input type="hidden" name="page" value="vote_to_post" />
    <input type="hidden" name="post_id" value="<{$post.id}>" />
    <input type="hidden" name="point" value="0" />
    <{if $caller == 'listposts'}>
        <input type="hidden" name="ret_name" value="topic_id" />
        <input type="hidden" name="ret_val" value="<{$topic.id}>" />
    <{/if}>
    <input type="submit" value="<{$smarty.const._MD_D3FORUM_VOTEPOINTDSCWORST}>" />
</form>

を削除するかコメントアウトする。(これが、「参考にならない」ボタン部分)

106行目あたりの

<form action="<{$mod_url}>/index.php" method="get" style="display:inline;">
    <input type="hidden" name="page" value="vote_to_post" />
    <input type="hidden" name="post_id" value="<{$post.id}>" />
    <input type="hidden" name="point" value="10" />
    <{if $caller == 'listposts'}>
        <input type="hidden" name="ret_name" value="topic_id" />
        <input type="hidden" name="ret_val" value="<{$topic.id}>" />
    <{/if}>
    <input type="submit" value="<{$smarty.const._MD_D3FORUM_VOTEPOINTDSCBEST}>" />
</form>

の最後にあるinputを改造して、ボタンに「いいね!」の数を表示させる

<form action="<{$mod_url}>/index.php" method="get" style="display:inline;">
    <input type="hidden" name="page" value="vote_to_post" />
    <input type="hidden" name="post_id" value="<{$post.id}>" />
    <input type="hidden" name="point" value="10" />
    <{if $caller == 'listposts'}>
        <input type="hidden" name="ret_name" value="topic_id" />
        <input type="hidden" name="ret_val" value="<{$topic.id}>" />
    <{/if}>
    <input type="submit" value="<{$smarty.const._MD_D3FORUM_VOTEPOINTDSCBEST}><{if !$post.votes_count == 0}>:<{$post.votes_count}><{/if}>" />
</form>

テーマ下のlanguageにて、d3forumの言語定数を上書きする設定を追加(元は、「参考になった」となっている)

define('_MD_D3FORUM_VOTEPOINTDSCBEST','いいね!');

これで、d3forum独自の「いいね!」ができあがる。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0