I have just finished modifications in my first dasBlog macro. This macro will add a shout-box to the dasBlog (see it on the right side of this blog). I have tested it successfully with Firefox and IE 5.5+. This macro is written for new version of dasBlog (version 2.0 - supports .Net framework 2.0). If you want to add this custom macro to your dasBlog, make sure you are using new version dasBlog 2.0.
On the best part, this macro uses Ajax to update the entries. It can refresh itself after a specified interval using Ajax calls. You can disable this behavior if you don’t want to update it silently. I have used XML to store the entires in a file on the webserver. So there is no need to bother about database. To make the look and feel for more controlled and customizable, I have added CSS support to shoutbox.
Here are few steps that will help you to add this macro to your blog. But before download macro and extract the zip file on your hard-drive.
<section name="newtelligence.DasBlog.Macros" type="newtelligence.DasBlog.Web.Core.MacroSectionHandler, newtelligence.DasBlog.Web.Core" />
<newtelligence.DasBlog.Macros> <add macro="AJmacros" type="AakashJain.AakashJainMacros,AakashJain"/></newtelligence.DasBlog.Macros>
<add verb="*" path="aakashjain/shoutBoxHandler.aspx" type="AakashJain.ShoutBoxHandler,AakashJain"/>
<
<appSettings> <add key="AakashJainShouts" value="~/content/aakashjainshouts.xml"/></appSettings>
The above piece of code add a key "AakashJainShouts" to specify the location of XML file in which all entries of shoutbox will be saved. I have chosen content directory to save the xml file in the code above. You can specify any directory on the webserver but make sure it should have write permission.
Now add the following line in your homeTemplate.blogtemplate file at a suitable place where you want shout-box to appear. (You can find this file in the current theme folder of your blog.)
<%AjShoutBox(max char,refresh interval,max entries)|AJmacros%>
Here is the description of each parameter,
max char (int) – Maximum number of characters allowed to enter in the message textbox of shoutbox. For name this is fixed to 30 characters.
refresh interval (int) – Enter the number of seconds when the shoutbox will update from new server. If you want to disable this feature enter anything less than 5.
max entries (int) – Maximum number of entries shown at a time in shout-box.
For instance - <%AjShoutBox(150,50,30)|AJmacros%>(In this example shoutbox will be refreshed in 50 seconds, upto last 30 entries will be shown and only upto 150 characters can be entered in the message.)
Now lets move to style part of shoutbox. After the above settings you would like to apply some styles and colors to shoutbox to match with your blog theme. For this matter I have kept all style related code in a separate style-sheet (ajshoutbox.css). You can find this stylesheet in the download package. To attach this stylesheet to your blog enter the following lines with in the <head> section of your homeTemplate.blogtemplate file.
<link media="all" rel="stylesheet" type="text/css" href="images/shoutbox.css"></link>
(You can keep the stylesheet file in any directory on your web server but I'd recommend the image directory of dasBlog. Attribute "href" specified the path of CSS file.)
Ok, now this shoutBox is ready to run on your blog. If you have any comments or suggestions please feel free to post them here.
Leave your comment
Remember Me
Post Timeline Calendar with Post
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.