Dave Burke : Freelance .NET Web Developer specializing in Online Communities

Unifying the look-and-feel of dnn, ngallery and .text at dbvt.com

This site's style is based on the Indiana Skin submitted to DotNetNuke for their 2004 Skinning Contest and is the work of Borza Paul Valentin.  Thanks, Borza, and I'm sorry you didn't win.  Here is a screenshot of Borza's original. 

It was important to me to present a consistent look across dnn, nGallery, and .Text and that they were part of a unified application.  Thusfar, that integration was focused on 3 objects:  1) the header, 2) footer, and 3) passing a user's dnn identity to nGallery and .Text to preserve the dnn “[user fullname]” | Login/Logout in the top-right header area.  This post will focus on unifying the header and footer.

nGallery

nGallery bases its skinning on templates, with template variables entered at runtime from the Definitions Class in the nGallery.Lib namespace. As in

///


/// This template variable is used to get the name of the album.
///

public static readonly string T_ALBUM_NAME  = "[$NG_ALBUM_NAME$]";

These varables are populated in a base Page class, nGalleryPage : System.Web.UI.Page.  I added custom template variables in my own Definitions Class and populated them in the nGalleryPage base class.

if (HttpContext.Current.Request.QueryString["uid"] != null)
{
 uid = int.Parse(HttpContext.Current.Request.QueryString["uid"].ToString());
 HttpCookie cookie = new HttpCookie(cookieName);
 if (cookie == null)
 {
  cookie.Expires = DateTime.Now.AddMinutes(20);
  cookie.Values.Add("uid", uid.ToString());
  HttpContext.Current.Response.Cookies.Add(cookie);
 }
 else
 {
  cookie.Values["uid"] = uid.ToString();
  HttpContext.Current.Response.Cookies.Set(cookie);
 }
 if (uid == int.Parse(XMLUtil.GetValue("AnonymousUserID").ToString()))
 {
  stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_LOGIN,
   nGallery.Lib.DBVT.Util.ShowLoginLink());
  stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_USERNAME,
   nGallery.Lib.DBVT.Util.ShowRegisterLink());
 }
 else
 {
  stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_LOGIN,
   nGallery.Lib.DBVT.Util.ShowLogoutLink());
  stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_USERNAME,
   nGallery.Lib.DBVT.Util.ShowRegisterLink(uid));
 }

 stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_ADMINLINK,
  nGallery.Lib.DBVT.Util.ShowAdminLink(uid));

}

As you can see, I added a Util class to retrieve the desired user names and strings.  A few things to note:

  1. For nGallery I created both a DotNetNuke Anonymous Public User account and a Public nGallery Access role to support all non-registered users

  2. I added a UserConfig Class shared across the apps, but here am only interested in the UserID (uid) to populate the header User Fullname | Login/Logout strings and URLs

  3. The ShowAdminLink(uid) displays the link to the nGallery administration area that I only want to show if users (like me) are in the nGallery Administrative Access role I created.

Finally, these template variables were plugged into my nGallery skin's template.header.html, as in

<TR>
<TD class=IndianaButtonContainer0 nowrap>[$DNN_DBVT_USERNAME$]</TD>
<TD class=IndianaButtonSeparator><SPAN class=OtherTabs>|</SPAN></TD>
<TD class=IndianaButtonContainer0 noWrap>[$DNN_DBVT_LOGIN$]</TD>
</TR>

.Text

I found .Text easier to customize, since it is based on a straightforward Skin controls (here, the header.ascx control), where I added simple Label webcontrols.  I used the same nGallery.Lib custom methods I created to display User Fullname | Login/Logout string and URL info, which was pretty cool.

 

Comments (3) | Post RSS RSS comment feed

Posted on 9/11/2004 1:23:00 PM by Dave Burke
Categories:
Tags: no tags for this post

Related posts

Comments (3) -

9/11/2004 4:11:00 PM Permalink

Cool, that was the information I was looking for. I just installed DNN on my local system.  I am elready enjoying it, however I dont like the default skin.

Sonu Kapoor |

9/16/2004 12:33:00 PM Permalink

Nice work on the nGallery mods! It's great to see people digging in and doing this themselves!


Take care,
-Jason (jalexander@telligentsystems.com)

Jason Alexander |

9/16/2004 1:22:00 PM Permalink

I'm flattered, Jason.  Hey, to me the nGallery base package is like Lasagne: pretty hard to screw it up!

Dave Burke |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke