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.

All other Modules /

Discuss all other Modules here.

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

[SOLVED]Comment module: how to install without composer ?


Go to End


5 Posts   1529 Views

Avatar
jaaf

Community Member, 24 Posts

8 February 2014 at 7:43pm

Edited: 08/02/2014 7:47pm

Hi,

I am very new to SilverStripe. I am reading the book about it but as I expected things have changed a lot since it was published.

I am at the stage of trying the comment module but as my site is hosted on a shared account, I cannot make use of composer.
I could do on a local site I have on my computer but my concern is to learn how to install it on line thus I try without composer.

Hereafter is what I did:

a) I downloaded the zip package and unzipped it locally. Then I put it on my local site's root renaming it "comments".
b) I visited the http://localhost/devbuild page and had the database updated apparently correctly.
c) I added this in mysite/_config.php

 // Adds commenting to the class SiteTree (all Pages)
	Commenting::add('SiteTree', array(
		'require_login' => false, // boolean, whether a user needs to login
		'required_permission' => false,  // required permission to comment (or array of permissions)
		'include_js' => true, // Enhance operation by ajax behaviour on moderation links
		'show_comments_when_disabled' => false, // when comments are disabled should we show older comments (if available)
		'order_comments_by' => "\"Created\" DESC",
		'comments_per_page' => 10,
		'comments_holder_id' => "comments-holder", // id for the comments holder
		'comment_permalink_prefix' => "comment-", // id prefix for each comment. If needed make this different
		'require_moderation' => false,
		'html_allowed' => false, // allow for sanitized HTML in comments
		'html_allowed_elements' => array('a', 'img', 'i', 'b'),
		'use_preview' => false, // preview formatted comment (when allowing HTML). Requires include_js=true
		'use_gravatar' => false,
		'gravatar_size' => 80
	));

Note: I also tried with Commenting::add('SiteTree');

d) I checked as said in the installation guide that I had $CommentForm in the Page.ss in (was not here but I added it after $PageComments) and visited http:localhost/admin/?flush=1

Results
I the pararmeter tab in CMS i have a new checkbox labelled "Allow comments"
If I let it unchecked no problem but if I check it, when I visit the page I get a server internal error.

Thank you in advance for help.

José

Avatar
thomas.paulson

Community Member, 107 Posts

9 February 2014 at 5:49pm

Hello Jaaf

if you are using SS3, you dont need $CommentForm, $PageComments will do

make sure to run http:localhost/SS_folder/?flush=all

Avatar
jaaf

Community Member, 24 Posts

9 February 2014 at 8:11pm

Edited: 09/02/2014 8:12pm

Hi Thomas,
Thank you for answering

I eventually got it. May be I did an adequate flush at a given time. At the moment I have not yet seen in the documentation the difference between ?flush=1 and ?flush=all. I never used the second but I guess it means flush all page caches.

About $CommentsForm I followed the instruction of the module but you are right, both are valid.

By the way, there is an other thing I don't understand. It is about the login/logout mechanism. Once logged as admin I don't see any mean to logout. But I will make a specific post for this unless you can give me the answer. Probably I am not far enough in my learning of the system though it seems to me it should have been placed at the first place in the tutorials.

Avatar
thomas.paulson

Community Member, 107 Posts

10 February 2014 at 5:26pm

Hello Jaaf

you can find the logout in admin side, on the top left , just beside the 'Hi username'

Thank You

Avatar
jaaf

Community Member, 24 Posts

10 February 2014 at 6:54pm

Hi Thomas,

Well ! I see the link now. Not quite obvious but I should have found it.
Elsewhere I have found in the book how to direct a visitor to the login and logout pages.
Things are getting clearer and clearer.

Thanks again

With kind regards