Jump to:

1835 Posts in 1139 Topics by 554 members

Blog Module

SilverStripe Forums » Blog Module » Customising the Comment Form HTML

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 5800 Views
  • chris_d
    Avatar
    Community Member
    21 Posts

    Re: Customising the Comment Form HTML Link to this post

    had a look at this too
    a google search for postcommentform silverstripe
    returns http://www.silverstripe.org/archive/show/247213

  • markguinn
    Avatar
    Community Member
    13 Posts

    Re: Customising the Comment Form HTML Link to this post

    Copy the file /cms/templates/PageCommentInterface.ss to your theme's templates folder, replace:

       <% if CanPostComment %>
          <h4><% _t('POSTCOM','Post your comment') %></h4>
          
          $PostCommentForm
       <% else %>

    With the following:

       <% if CanPostComment %>
          <% control PostCommentForm %>
           <h4><% _t('POSTCOM','Post your comment') %></h4>
          
             <% if IncludeFormTag %>
             <form $FormAttributes>
             <% end_if %>
                <% if Message %>
                <p id="{$FormName}_error" class="message $MessageType">$Message</p>
                <% else %>
                <p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
                <% end_if %>
                
                <fieldset>
                   <legend>$Legend</legend>
                   <% control Fields %>
                      $FieldHolder
                   <% end_control %>
                   <div class="clear"><!-- --></div>
                </fieldset>
             
                <% if Actions %>
                <div class="Actions">
                   <% control Actions %>
                      $Field
                   <% end_control %>
                </div>
                <% end_if %>
             <% if IncludeFormTag %>
             </form>
             <% end_if %>
          
          <% end_control %>
       <% else %>

    This is essentially pasting the contents of the default Form.ss template into the overridden template inline. You should be able to then make any changes you want to make, including specifying the fields explicitly (see http://doc.silverstripe.org/doku.php?id=form under "Using a custom template" for more information about what that would look like).

    That's the best way I can see to do it without modifying system classes. I know this question was asked several months ago, but this is probably a common question, so hopefully it will help someone.

    Mark

    5800 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.