31 July, 2007

Templates and themes and skins...OH MY

Templates, templates, templates!

One of the great new features of ASP.NET in the 2.x/3.x framework are templates. Short story, templates are just what they imply, the create a basic framework for you ASP.NET application, into which you stick your content.

We all like sites that are intuitive and easy to navigate. Before now, the way we achieved this was either through frames, user controls and/or simply copying code to all the pages. This would get the breadcrumb trail and the left margin links and the header an all that great stuff. The most efficient, IMO were user controls. You create a control, and stick it on each page, then if you needed a change, you just change the control, not having to bother with the other pages.

Templates work in much the same way, but they go beyond that. With ASP.NET 2.x you can apply themes and skins to your site by simply identifying which one to use. You can have blue skins, and red skins and purple skins. And you can allow the visitor to select which skin they like best, and load that one for them.

Themes are a little more in depth. Anyone familiar with blogger or wordpress or other blogging formats will understand the themes idea. A theme defines the layout and module content of the page. What I am referring to as module content in this case are the little applet type things one finds on pages. Like the aforementioned breadcrumb trail, the header, the footer the sidebars, the ad space, the blog rolls or other links. Basically, everything that is not your main content, that you want viewable on every page.

There are a plethora (gosh I love that word - plethora - it just kind of rolls of the tongue, doesn't it?) of pages out there with information on how to use templates, and with some digging, one can find instructions on how to make templates. Please note, templates,skins and themes make extensive use of CSS. If you don't understand CSS, it would be a really good idea to learn more about that first, because it will only frustrate you in the end!

One of the best sources I have found for theme information and instruction is Microsoft's ASP.NET Quickstart Tutorials. This is setup so, if you know the basics, and are familiar with ASP.NET 1.1, you can jump right into what you are looking for.

If creating your own template seems to daunting a task, you can download several templates from the MSDN site, then customize as you see fit! The templates are available in both VB and C# source, so which ever you use, you can use these templates.

Over the next few weeks (hopefully not that long, but you never know). I'm going to create a template from scratch (hopefully it will be visually appealing, but again, you never know), and use this site to document my efforts. The template I am going to create will be for a blog. I have been (as stated in other posts I think) lamentful that there is really good, easily usable and easily findable blog software written in ASP.NET (especially C#). So I am going to create blog software to do that. First, I must create the database though, and for that I am going to borrow heavily from the mySQL database used for WordPress blogs. That database has pretty much everything I can think to need, but there are something I think I would do differently, so I'm going to use the schema as base point to start from. The database will be created using Microsoft SQL Server 2005.

Hopefully, but the end of the week, I'll have a database diagram that I can post here and (if anyone is actually reading this) can get some feedback on.

Until then, take care, and thanks for visiting! (seriously, you can leave comments and everything!)

No comments: