Showing posts with label Publishing. Show all posts
Showing posts with label Publishing. Show all posts

DNN (Dotnetnuke) module development in 10 easy steps

· 0 comments

When I was about to launch my web application, I found myself in front of a daunting task of creating support pages for the website. It is difficult for solo acts like me to think about content for Privacy policy, Terms of Use, Copyright as well as support facilities like forums, feedback, faq and even plain and simple help pages. I’m no web designer too. Dotnetnuke has allowed me to do all these and in less than a day I was able to get it up and running with most of the support pages in place. Having have to worry only about content, in a few more days, the rest of the pages are there too.

Now, what about my pre-existing web pages? I need to convert them to Dotnetnuke modules. Looking around there were very limited resources on the internet on how to go about this. Even forums don’t contain that much information. I’ve downloaded documents for Dotnetnuke Module Development but they were more geared toward re-distributing these modules. Thus too complicated and time consuming for my needs. I might as well create the support pages myself in plain html or .aspx. I just need a quick and simple way to convert my web forms to Dotnetnuke modules.

After a substantial time of tinkering, I was finally able to do it and narrow down DNN Module Development to 10 easy steps. I’m putting it here so that those of you on the same predicament might have use for it and spare yourself the wasted hours trying to figure it out.

To begin,

1. Locate the DesktopModules Folder under you DNN website.
2. Create a under folder it and name it HelloWorld.



3. Right-click the said folder and click Add New Item
4. Select Web User Control and Name it HelloWorldModule.ascx



5. Replace class declaration to inherit from DotNetNuke.Entities.Modules.PortalModuleBase instead of System.Web.UI.UserControl
6. Import the namespaces DotNetNuke and DotNetNuke.Entities.Modules
7. Now let’s do something simple, drag and drop a Label control in the design view of your User Control.
8. On your code behind, create a page load event and add Label1.text = “Hello World!”

You user control’s html should now look like this.


<%@ Control Language="VB" AutoEventWireup="false" CodeFile="HelloWorldModule.ascx.vb" Inherits="DesktopModules_DNNSchool_HelloWorldModule" %>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


And your code-behind class like this


Imports DotNetNuke
Imports DotNetNuke.Entities.Modules
Partial Class DesktopModules_DNNSchool_HelloWorldModule
Inherits DotNetNuke.Entities.Modules.PortalModuleBase

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = "Hello World!"
End Sub
End Class


9. Login to your DNN website and go to Host > Module Definitions. Locate “Import Module Definition” link and click
10. From Control dropdown, locate DesktopModules/HelloWorld/HelloWorldModule.ascx and click Import Control



Your first Dotnetnuke Module is now available in the Module dropdown in the Control Panel. Congratulations!



Go ahead and to a page. You’ll see your new Dotnetnuke module declaring it’s existence to the world.




Just repeat steps 2-7 if you want to create more Modules. Probably step 1 too if your want a “cooler” folder name. Then just code as you would any other Web User Control or a Web form for that matter in Visual Studio.

Find IP Address Location By Country in ASP.Net

· 0 comments

Being able to tell on-the-fly which country your visitors come from is a big boon. The applications are numerous. You can use it to extend your security by limiting to certain countries only. Or perhaps you want present a different page or ad per country. Or you just want to automatically select the country in the dropdown of your forms.

Fortunately, thanks to MaxMind, this is all free and easy. Here are 5 simple steps:


1. Download API files and extract
2. Copy CountryLookup.vb to you App_Code folder or Class Library
3. Download Database and extract
4. Copy GeoIP.dat and place it on your website.
5. Start using it.

Dim _UserIPAddress As String = Me.Page.Request.UserHostAddress
Dim _IPDataPath As String = Me.Page.Server.MapPath("data/GeoIP.dat") 'relative path to the Geo IP Database.
Dim _CountryLookup As CountryLookup = New CountryLookup(_IPDataPath)
Dim _CountryName As String = _CountryLookup.LookupCountryName(_UserIPAddress)
Response.Write(_CountryName)


C# API is also available here as well as other programming languages. APIs also come with country flag images which you can use to create cool user interfaces.


Free counter and web analytics in real-time

· 0 comments

Google analytics is awesome. However, a 24-hour wait time is just too long for someone who has just started a website. Its reports are also very broad and probably more appropriate for big websites with thousands of hits a day. I needed to do my tracking in real time so that I could get information about my visitors immediately. Where they are coming from, what pages they are viewing and what’s stopping the website from getting conversions. That way I could make corrections in an instant.

So I did a quick search on Google for “real time website tracking”. On the first page, I only found one that’s free and immediately available. And that is StatCounter. Others were either on free trial or available only through paid subscription or on beta or by invitation only. * I realized while writing this blog entry that I should have typed “free real time website tracking” instead but then...I already found what I want.

I’ve been using it the past couple of days and I find really helpful. My website is a free web based personal finance software. So conversion for me means registrations and signups. Knowing what pages my visitors are viewing tells me what their specific needs and requirements are. The pages they exit from gives me a clue what I needed to add or remove. In summary here’s how I find StatCounter:

The good:

1. Immediately available, free and not a trial offering.
2. Tracks visitors in real time
3. Detailed information of each individual visits – where they come from, who referred them, what they are viewing, which pages they exited.
4. Has blocking cookies to ignore your own visits.

The bad:

1. Up to 500 detailed logs per website only.
Old logs get overwritten when this is used up. If you want more you need to pay. However, who wants to keep track of each of those 500 recent visits? As for me, I only need the last few.

2. Reports are not as good and numerous as Google Analytics.

My recommendations:

Use both Statcounter and Google Analytics. I would liken it to a war (pardon the comparison). Soldiers on the field need immediate feedback and information of the ongoing battle. While generals on HQ need to know how the war is progressing. These two, for those who are looking for a free service, is an amazing combination.


Recent Posts

About Me

Alain Rivas
A software / web developer by profession.
A Born-Again Christian by Faith.
A father of two (with one on the way).
A husband of one.
Once a radio disc jockey for eight years.
Now a geek glued to his computer.
View my complete profile