This module allows you to organize easily a guest book on the site. It is supported data output by the pages (using TemplatePaging control). Messages from the guest book can also be displayed in RSS format (if the message list is displayed, the links to RSS versions are automatically added to Meta tags). Administrator can write a reply to any message through the administrative interface.
In a GuestBook tag you can use the following tags:
- TopPart - top part template of a guest book message list;
- BottomPart - bottom part template of a guest book message list;
- ItemTemplate - template of a message without author’s e-mail;
- ItemWithoutEmailTemplate - template of a message with author’s e-mail;
- AnswerTemplate - reply message template;
- Separator - separator between guest book messages.
 |
Use <%# Container.RSSUrl %> in the TopPart and BottonPart tags to get a link to RSS version |
In the ItemTemplate and ItemWithoutEmailTemplate tags of the GuestBook tag you can use the following parameters:
| Template's part |
Description |
<%# Container.Date %> |
Message's date |
<%# Container.Email %> |
Author's e-mail |
<%# Container.GetAntispamEmailLink( linkText, linkAttributes) %> |
This function forms antispam author's e-mail link |
<%# Container.Author %> |
Author's name |
<%# Container.Subject %> |
Message's subject |
<%# Container.Text %> |
Message's text |
<%# Container.Answer %> |
Answer's text |
<%# Container.IP %> |
Message author's IP |
In the AnswerTemplate tag you can use <%# Container.Text %> parameter that returns a reply text.
To add a new entry to the guest book you have to add the following fields in UserControl:
| Template's part |
Description |
<asp:TextBox id="tbxAuthor" runat="server" /> |
Input field for author's name |
<asp:TextBox id="tbxEmail" runat="server" /> |
Input field for author's e-mail |
| <asp:TextBox id="tbxSubject" runat="server" /> |
Input field for message's subject |
<asp:TextBox id="tbxText" runat="server" Rows="6" Columns="60" /> |
Input field for message's text |
<asp:Button id="btnSave" runat="server" Text="Save" /> |
Submit button |
 |
Do not forget to add text field validators. You can also use anti robot image to ensure that the message is typing by a man. |
The UserControl itself with a guest book template should be inherited from the CMSLib.Modules.GuestBook.GuestBookPage class.
A template file for this module lies in a modules/guestbook folder and can look as follows:
|
<%@ Control Language="c#" Inherits="CMSLib.Modules.GuestBook.GuestBookPage" %> <%@ Register TagPrefix="cmsg" Namespace="CMSLib.Modules.GuestBook" Assembly="CMSLib" %> <%@ Register TagPrefix="cmsctp" Namespace="CMSLib.Controls.TemplatePaging" Assembly="CMSLib" %> <%@ Register TagPrefix="cmsc" Namespace="CMSLib.Controls" Assembly="CMSLib" %>
<cmsg:GuestBook id="GuestBook1" runat="server"> <TopPart>Records<BR></TopPart> <ItemTemplate> <%# Container.Date.ToString() %>- <%# Container.GetAntispamEmailLink(Container.Author, " class=\\\"h5\\\"")%> <%# Container.Author %></A> <%# Container.Subject %> <%# Container.Text %> </ItemTemplate> <ItemWithoutEmailTemplate> <%# Container.Date.ToString() %>- <%# Container.Author %> <%# Container.Subject %> <%# Container.Text %> </ItemWithoutEmailTemplate> <AnswerTemplate> <span style="color: red;" ><%# Container.Text %></span> </AnswerTemplate> <Separator><hr></Separator> <BottomPart><BR></BottomPart> </cmsg:GuestBook>
<cmsctp:TemplatePaging runat="server" ControlForNavigate="GuestBook1" />
<p> </p>
Author <asp:TextBox id="tbxAuthor" runat="server" /> <asp:RequiredFieldValidator id="valAuthor" runat="server">*</asp:RequiredFieldValidator><br />
E-mail <asp:TextBox id="tbxEmail" runat="server" /> <asp:RegularExpressionValidator id="valEmail" runat="server">*</asp:RegularExpressionValidator><br />
Subject <asp:TextBox id="tbxSubject" runat="server" /> <asp:RequiredFieldValidator id="valSubject" runat="server">*</asp:RequiredFieldValidator><br />
Text <asp:RequiredFieldValidator id="valText" runat="server">*</asp:RequiredFieldValidator><br /> <asp:TextBox id="tbxText" runat="server" Rows="6" Columns="60" /><br />
Validation <cmsc:AntiRobotTextBox id=AntiRobotTextBox1 runat="server" />
<p><asp:Button id="btnSave" runat="server" Text="Save" /></p>
|
 |
Also you can place a block with records from guest book connected with certain menu item everywhere on your site. For that you should set a MenuItemGuid attribute into required menu item key:
|
<%@ Register TagPrefix="cmsg" Namespace="CMSLib.Modules.GuestBook" Assembly="CMSLib" %>
...
<cmsg:GuestBook ID="GuestBook1" runat="server" MenuItemGuid="651d9451-e5ea-43fe-a56a-1e3243b36b75" />
| |
Modules: Modules
Controls: Anti robot image | TemplatePaging
© 2005-2007 Astron Digital Ltd. All Rights Reserved.