Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

PageComments holder styling (Comments template)


Go to End


4 Posts   2701 Views

Avatar
Tonyair

Community Member, 81 Posts

11 June 2010 at 3:58am

$PageComments generates such code:

<div id="PageComments_holder" class="typography"> 
 
	<h4>Leave Comment</h4> 
	
		
			
<form  id="PageCommentInterface_Form_PostCommentForm" action="/stable/home/page-22/iran-pokusali/PageComments/PostCommentForm" method="post" enctype="application/x-www-form-urlencoded">

...
...
</form>
<h4>Comments:</h4>
...

I stylized form with float:right; so form is to the right from comments, but phrase "Leave Comment" placed to the left.
It looks unlogical, so i'd like to place it to the right - above post form, but "Comments:" will be placed to the right too it's weird and I can't use css selectors there, so i have to modify comments template, but how i can do it?

Avatar
Willr

Forum Moderator, 5523 Posts

12 June 2010 at 10:35pm

You can override any templates from core in your our theme. So in this case its the PageCommentInterface.ss template from cms/templates/ that you would want to copy to your theme. You can then edit the file as you wish. Make sure you ?flush=1 after making the change :D.

Avatar
Tonyair

Community Member, 81 Posts

14 June 2010 at 5:18pm

Thx, but what about comments posting form?

Avatar
Willr

Forum Moderator, 5523 Posts

14 June 2010 at 5:31pm

Well the actual form code is generated just like every form in SilverStripe. Using the Form.ss template and rendering the individual form fields from the PHP. For customizing the PageComments Form you could try defining a PageCommentInterface_Form.ss template in your theme.

See this page for more information on how templating a form works. http://doc.silverstripe.org/form#using_a_custom_template.