Fast, Flexible & Easy
Menulab home > Discussions >  Example - Comments mode 

Discussions Logo Discussions Comments mode


This example will show how to use Discussions in Comments mode to put comments on your web pages.

In Comments mode, Discussions will render as a full featured comment track on the host page. Default everything will work and if you have comments on multiple pages, Discussions will know itself what comments belong to what page.

Below Discussions is rendering as a comment track - try it out :

Try it out - add comments without logging in, but more options if you login as Admin using password Admin :
(Changes you make to any Discussions example will accummulate and persist throughout your menulab.com session)

Profile
Username
Password
Password
Email
Nickpic
Get notified then any new post is added  (only works if you specify an email address)
Get notified on reply to own posts  (only works if you specify an email address)
Get notified on receiving a PM  (only works if you specify an email address)
Remember my username
Remember my password
signature
Words: Chars: Chars left: 
    

Steps to reproduce the above comment track :

  1. Register Discussions on an .aspx page or an .ascx usercontrol :
    <%@ Register Assembly="Menulab.Discussions" Namespace="Menulab" TagPrefix="ml" %>
    
  2. Add a Discussions instance somewhere on your page (or on a usercontrol) :
    <ml:Discussions ID="mlDiscussions" runat="server" />
    
  3. In the code behind insert the following in the in Page_Load function :
    protected void Page_Load(object sender, EventArgs e)
    {
    		mlDiscussions.mlMode = Menulab.Discussions.ModeEnum.Comments; //this is what makes Discussions render as a comment track and the only necessary property to set
    
    		//The following properties are not necessary, but here they will enhance the example value of the above comment track
    		mlDiscussions.mlIncludeLoginControls = true//default false in Comments mode, however in this example it gives good meaning to include login controls
    		mlDiscussions.mlFocusLoginControlsBeforeLogin = true//default false in Comments mode to avoid page scrolling to the bottom
    		mlDiscussions.mlEnableSmartBookmarks = false//default true in Comments mode to avoid page to jump to top
    		mlDiscussions.mlConfig.Posts.IncludeVoting = true//default false in Comments mode
    }
    

Customization

The most important customization settings of a Discussions comment track are :

  • mlIncludeLoginControls : set to true to display login controls letting users accessing the user system. Default the Captcha will be removed if a user is logged in.
    • mlFocusLoginControlsBeforeLogin : default false in Comments mode to avoid the page scrolling down to the comments typically positioned at the bottom of the page.
  • mlEnableSmartBookmarks : default true in Comments mode to be sure that then a user do an action in the comment track, the page scrolls to put the action relevant content into focus, however a comment track at the top of the page would benefit from setting this property to false.
  • mlDiscussionLayout : default is Hierarchy in both Forum & Comments mode, however other comment track layout possibilities are Threads or Flat.
  • mlPageIdent : Discussions is attaching comments to a page based on the page name and absolute path, however if you use eg. query string parameters to deliver different pages that should have different comment tracks, then you need to set mlPageIdent to a unique value for each page (eg. the query string key&value that identifies the page).
  • mlRichTextBoxes.AddReply : the AddReply RichTextBox configures the rich text editor allowing users to input posts, eg. say you want to allow maximum 500 chars per post and to display only Bold and Forecolor buttons, you would have to add the following in the Page_Load function :
    protected void Page_Load(object sender, EventArgs e)
    {
    	mlDiscussions.mlRichTextBoxes.AddReply.mlCounters.MaxChars = 500;
    
    	mlDiscussions.mlRichTextBoxes.AddReply.mlButtons.Clear();
    	mlDiscussions.mlRichTextBoxes.AddReply.mlButtons.Add(Menulab.RichTextBox.Button.Bold);
    	mlDiscussions.mlRichTextBoxes.AddReply.mlButtons.Add(Menulab.RichTextBox.Button.Forecolor);
    }
    
    For full overview of settings for the rich text editor, please see RichTextBox - Documentation.
  • mlConfig.CaptchaIsOnFor : default is LoggedInUsers, so if you are not Moderator or Admin, then you will be bothered with the captcha, this makes it a little more troublesome for spammers, however you can set the value to Guests or even to Never to remove the captcha hassle altogether.
  • mlConfig.RepliesCanBeAddedBy : in Comments mode guests can default add comments, however you can set it to eg. LoggedInUsers (which is default in Forum mode) to force users to register with you if they want to add a comment.
  • mlConfig.Posts.IncludeVoting : in Comments mode voting is default disabled, however you just set mlConfig.Posts.IncludeVoting to true to enable voting.
    • mlDiscussions.mlConfig.GuestCanVote : default false. If you set to true then you don't need to login to vote, however it can then only be semi-controlled that the same user is not voting multiple times on the same post.
  • mlConfig.FacebookIsDefaultSelected : default false, however set to true to give users a little push to reference your page on facebook.

Also don't forget that you can show your comment tracks as fully functional discussions anywhere in a forum, see Discussions Example - Import Comments.


Comments

 
 B  U  I  S  I  S  T  V  U  ? 
Words: Chars: Chars left: 
 Captcha 
 Nickname
Facebook
    

Terms & Conditions    |    Privacy Policy    |    Sitemap    |    Copyright © Menulab 2012. All rights reserved.