mtde.info

Movable Type Developers Express

(モジュール)コメント入力フォームのモジュール

2008年2月23日 22:09 | Writer: apstar | 記事本文

テンプレートモジュール>コメント入力フォームのモジュール記述例です。

このモジュールは、エントリに対してコメントを投稿する時に使用するテキストボックスなどを表示するためのものです。

ファイル名:comment_form.mtml

<MTIfCommentsAccepted>
<div class="comments-open" id="comments-open">
    <h3 class="comments-open-header">コメントする</h3>
    <div class="comments-open-content">
    <MTIfRegistrationAllowed>
            <div id="comment-form-external-auth">
                <script type="text/javascript">
                <!--
                <MTIf name="comment_preview_template">is_preview = true;</MTIf>
                writeCommenterGreeting(commenter_name, <$MTEntryID$>, <$MTEntryBlogID$>, commenter_id, commenter_url);
                //-->
                </script>
            </div>
    </MTIfRegistrationAllowed>
        <form method="post" action="<$MTCGIPath$><$MTCommentScript$>" name="comments_form" id="comments-form" onsubmit="if (this.bakecookie.checked) rememberMe(this)">
            <input type="hidden" name="static" value="1" />
            <input type="hidden" name="entry_id" value="<$MTEntryID$>" />
            <input type="hidden" name="__lang" value="<$MTBlogLanguage$>" />
            <div id="comments-open-data">
                <div id="comment-form-name">
                    <label for="comment-author">名前</label><br />
                    <input id="comment-author" name="author" size="30" value="<MTIf name="comment_preview_template"><$MTCommentAuthor encode_html="1"$></MTIf>" />
                </div>
                <div id="comment-form-email">
                    <label for="comment-email">電子メール</label><br />
                    <input id="comment-email" name="email" size="30" value="<MTIf name="comment_preview_template"><$MTCommentEmail encode_html="1"$></MTIf>" />
                </div>
                <div id="comment-form-url">
                    <label for="comment-url">URL</label><br />
                    <input id="comment-url" name="url" size="30" value="<MTIf name="comment_preview_template"><$MTCommentURL encode_html="1"$></MTIf>" />
                </div>
                <div id="comment-form-remember-me"><br />
                    <label for="comment-bake-cookie"><input type="checkbox" id="comment-bake-cookie" name="bakecookie" onclick="if (!this.checked) forgetMe(document.comments_form)" value="1" />
                        ログイン情報を記憶</label>
                </div>
            </div>
            <div id="comments-open-text">
                <label for="comment-text">コメント <MTIfAllowCommentHTML>(スタイル用のHTMLタグを使うことができます)</MTIfAllowCommentHTML></label><br />
                <textarea id="comment-text" name="text" rows="15" cols="50"><MTIf name="comment_preview_template"><$MTCommentBody autolink="0" sanitize="0" convert_breaks="0" encode_html="1"$></MTIf></textarea>
            </div>
            <MTIfNonEmpty tag="MTCaptchaFields">
            <MTIfCommentsAccepted><MTIfRegistrationAllowed><MTElse><$MTCaptchaFields$></MTIfRegistrationAllowed></MTIfCommentsAccepted>
            <div id="comments-open-captcha">
            </div>
            </MTIfNonEmpty>
            <div id="comments-open-footer">
                <input type="submit" accesskey="v" name="preview" id="comment-preview" value="確認" />
                <input type="submit" accesskey="s" name="post" id="comment-submit" value="投稿" />
    <MTIf name="comment_preview_template">
                <input type="button" name="cancel" id="comment-cancel" value="キャンセル" onclick="window.location='<$MTEntryPermalink$>'" />
    </MTIf>
            </div>
        </form>
    </div>
</div>
</MTIfCommentsAccepted>

以下、特記事項です。

テンプレートの作成例

2008 mtde.info