Posts in Category: Tutorials

A Few New Tutorials

Just a quick post to mention a few new tutorials for mojoPortal.

How To Filter Out Un-Wanted Content From Feed Manager

by Walter Ferrari of Abertech. Big thanks to Walter! He not only helped with major improvements to the Feed Manager recently but also is willing to help with documentation which is much appreciated.

CSS - Its All About Understanding Selectors

an article I wrote today to demystify CSS a little for those trying to learn how to skin mojoPortal. Once you master CSS Selectors it becomes much easier.

Enjoy!

Gravatar Joe Audette is the founder of the mojoPortal project and was the primary developer until February 2017.

Hello World mojoPortal Quick Start Code

Just completed a new documentation page to help developers get going quickly with mojoPortal.

Hello World - Developer Quick Start

The article has a zip with sample code you can drop in and start hacking on with a few simple steps as indicated in the article. It shows how you can use a plain old UserControl or a UserControl that inherits from SiteModuleControl. Both examples also illustrate the use of the ASP.NET UpdatePanel for ajax postbacks.

Enjoy!

Gravatar Joe Audette is the founder of the mojoPortal project and was the primary developer until February 2017.

A Custom AdRotator - Borrowing Code from The Mono Project

Sometimes in ASP.NET development you need just a little different functionality than what the built in controls have. Often you can inherit the control and extend functionality on top of the original version, but sometimes you wish you could just make a small change to the inner workings of the control. One option is to borrow the Mono implementation and modify it to meet your needs.

So today I wanted to implement an Ad Rotator so I could alternate the banner ad on mojoPortal.com to switch between my add for Event Calendar Pro and Form Wizard Pro. There is a built in AdRotator control in ASP.NET, so I read a few articles about it, here and here. In those articles they suggest click tracking by using a redirect page, but I wanted to track it in google Analytics since we already have it integrated in mojoPortal. To do this I need to add an onclick to the rendered link to call the tracking code and then navigate to the href. So an example onclick for tracking is like this:

onclick="mojoPageTracker._trackPageview('/EventCalendarProBanner.aspx');window.open(this.href,'_self');return false;"

This just tracks a made up url (/EventCalendarProBanner.aspx) before navigating to the linked product page.

The ASP.NET AdRotator control can consume an xml file in this format:

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/images/Contoso_ad.gif</ImageUrl>
<NavigateUrl>http://www.contoso.com</NavigateUrl>
<AlternateText>Ad for Contoso.com</AlternateText>
</Ad>
<Ad>
<ImageUrl>~/images/ASPNET_ad.gif</ImageUrl>
<NavigateUrl>http://www.asp.net</NavigateUrl>
<AlternateText>Ad for ASP.NET Web site</AlternateText>
</Ad>
</Advertisements>
 

But I wanted to add another property to store my OnClick code, so my new format is like this:

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/Data/Sites/1/skins/mojosite-brightside/eventcalpro-banner.gif</ImageUrl>
<NavigateUrl>~/event-calendar-pro-offer.aspx</NavigateUrl>
<AlternateText>A better event calendar for mojoportal</AlternateText>
<OnClientClick>mojoPageTracker._trackPageview('/EventCalendarProBanner.aspx');window.open(this.href,'_self');return false;</OnClientClick>
</Ad>
<Ad>
<ImageUrl>~/Data/Sites/1/skins/mojosite-brightside/formwizardpro-leaderboard.gif</ImageUrl>
<NavigateUrl>~/form-wizard-pro-single-installation-license-offer.aspx</NavigateUrl>
<AlternateText>Form Wizard Pro - Easy Forms for mojoPortal</AlternateText>
<OnClientClick>mojoPageTracker._trackPageview('/FormWizardProBanner.aspx');window.open(this.href,'_self');return false;</OnClientClick>
</Ad>
</Advertisements>

Since I don't really have access to the internal workings of the ASP.NET AdRotator, I decided to have a look at the source code for the Mono project implementation of this control. I downloaded the 3 files AdRotator.cs, AdCreatedEventArgs.cs, and AdCreatedEventHandler.cs, added them into my mojoPortal.Web.Controls project and changed the namespace so it wouldn't clash with the built in ASP.NET version. I had to modify a few small things where it was using some internal Mono stuff but not much. I added the OnClientClick property to AdCreatedEventArgs.cs and added on line of code to the render method of AdRotator.cs:

if (e.OnClientClick != null && e.OnClientClick.Length > 0)
w.AddAttribute(HtmlTextWriterAttribute.Onclick, e.OnClientClick);

I add it to my layout.master (Master Page) and configure it to read the xml file with my ads:

<mp:AdRotator id="ads1" runat="server" AdvertisementFile="~/App_Data/mojoads.ads" />

And voila, it works and only took about 20 minutes to implement.

 

Gravatar Joe Audette is the founder of the mojoPortal project and was the primary developer until February 2017.

A Few New Developer Docs

Just a quick post to point out some new documentation for mojoPortal developers.

Setting Up Your Projects - has notes about how to work with mojoPortal from our repository and your own code from your own repository.

Using The Installation System - talks about how to leverage the mojoPortal installation system to install your own features.

Using The Task System - discusses a little framework we have for managing long running tasks on a background thread. You can implement your own and plug them in. I built it for sending the news letter emails. It can chug through a long list effectively because it can resume even if the thread is killed by recycling the app pool. When the app starts again it picks up where it left off.

Gravatar Joe Audette is the founder of the mojoPortal project and was the primary developer until February 2017.

Happy New Year and a New Video Tutorial

Happy New Year mojoPortal Community!

To celebrate (boy I really know how to party!), I finally got around to making a video tutorial covering the basics of using mojoPortal.

mojoPortal User Guide Volume 1

One of my resolutions for the new year is to do more video tutorials.
Another is to make another batch of good looking skins. Using free designs I made 10 skins in 10 days several months ago. I still have a bunch of designs I dowloaded before that I didn't get to, I just need to find another week or 10 days to throw at them.

I'm also getting very close to making a release, I know I've been saying that for weeks but some things have gone slower than anticipated. Newsletter is a complex feature. If I don't finish it soon I'll just go ahead and make a release without it as there is lots of other good stuff available now in svn that needs to be set free. Of course anyone working with the source code is smart to be getting the code from svn trunk and not waiting for me to get around to making releases.

If there are particular topics you would like to see tutorials about please let me know. Also any feedback about this one is appreciated. It was just a quick improvised one. I actually did a better longer one first only to realize at the end it wasn't capturing audio. So when I did it again I kept it a little brief.