HtmlDirect: A new DotNetNuke module to include html files directly in your page

When creating DotNetNuke sites, I find myself editing my html in the text editor of my  choice, saving the file to make the changing easier in the future, and then copying and pasting the html code into the html module in source view. I don’t use the Wysiwyg editor at all quite frankly it gets in my way most of the time. This is particularly true when editing a full highly stylized page. To solve this problem, I’ve decided to create a new module named HtmlDirect. It will be created using the BigfootDNN project and it will be open source:  HtmlEditor_Crossed

 

This is workflow I want to use when editing these static html content to be included in my portal:

1. Open my favorite html editor

2. Create a new html file and write some cool / mean / clean html code

3. Reference some special css and js files if I want to

4. Upload it to my site

5. Add the html direct module, point it to the file and that’s it.

Editing is now simply opening the html file, editing it and republishing it. Rinse and repeat.

You are probably wondering why not just create a simple html / or asp.net website?

The answer is that I want to take advantage of many of the DotNetNuke modules out there, but I still want to edit my static content pages easily and without the delay of having to open up the page, login, open the page, select edit on the html module, pasting the html code, and hit save.

Convention over configuration

I don’t want to have any options on the module other than the relative location to the file without having to specify the extension so for home/content.html i just want to refer to it as home/content in my module. Convention to follow:

1. Every portal root folder will have a folder in it called ~/Portals/[PortalId]/HtmlDirectFiles.

2. HtmlDirectFiles Structure:

               HtmlDirectFiles
                     – images
                     – css
                      – js
                      – file.html | foldername/file.html

3. Files must be named with the extension .html

4. Html file will reference images, css, and js files relative to its location. When you upload your html file, also upload your images, css, and any js files to corresponding folder under HtmlDirectFiles folder.

5. Html file will not include the html, head, or body tags

6. DotNetNuke caching rules will be followed

Of course content editors will have to be smart about referencing css and js files taking into account the implications of including the files multiple times on the page, etc. I assume we are all pros here and you know that you are doing and how to avoid this.

That’s it, pretty simple really, but should make my life a lot easier. Stay tuned for a release date.

Cheers!

Advertisement

3 responses to this post.

  1. Nice! I took a slightly different approach to solving the same problem by extending the Html module to allow settings where I can define “Source Only” editing. BTW, love the “Convention over Configuration” approach which I use a lot myself as it simplifies things a lot.

    Reply

    • Hi Mike,

      I’m glad you like the idea. The main thing that bothers me about the current approach is that you have to open the module in edit mode copy and past your html and hit save. After also making sure you are saving the file in your editor to make editing easier in the future. It feels like duplicating work.

      I’ll keep you posted.

      Mitch

  2. [...] September 27, 2010 by Mitch Labrador in Technology. Leave a Comment A few weeks back I blogged about wanting to create a module that would simply output the contents of an html file. After watching Bill Morgenweck video on how [...]

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.