HomePortals 3.1 Early Beta

For the last few weeks I have been working again on the development of HomePortals; picking up where I left a few months back and implementing a couple more ideas that I had. As I get closer to a final "3.1" release, I wanted to start sharing some info on what has changed and explain a bit more on the new features and what possibilities they open.

First of all, if you are unfamiliar with HomePortals it is basically a web-based framework to handle modular layout rendering. The whole point is to provide a declarative way of indicating which content goes where on a page.


Back To Basics

For this release I wanted to zero-in on making HomePortals a framework/environment that would be easy and even fun to program in. I focused a lot on cleaning up and removing everything that was not part of the "core" functionality or was not essential to the main goal of the project, which was to provide an engine to layout modular content on a web page.

This cleanup process led to two major changes:

  • a) A more compact API and
  • b) An extensible plugin architecture to extend the available features



A cleaned up and easier to use API
First, the directory containing the framework has now been renamed to a more consistent "/homePortals" instead of the awkward and potentially conflictive "/Home" of previous versions.

The whole application environment can now be contained on a single instance of the homePortals.cfc object, which can be initialized at its minimum just by passing the path to wherever the host application is located. No need for config files or special folder structures. You now have the option to completely configure an application programatically (calling a bunch of setters) or, as always, by having a config file with your settings. Its your choice.

So for example, if I want to use homePortals in an application with path /mySuperApp, I just need to have this line somewhere in my application code (Application.cfc, index.cfm, wherever you like):

<cfset application.homePortals = createObject("component","components.homePortals.homePortals").init("/mySuperApp")>

And you don't even need to use the application.homePortals variable; you can put your instance anywhere. However, since IT IS a whole environment you may really want to consider using it as a singleton to avoid going through the initialization process again and again.

Once initialized, the homePortals instance lets you access any part of the HomePortals environment. You can modify its settings, call the high level features, and even go into a lot of the internal guts to get the exact behaviour you want.

The fact that the entire homePortals environment is contained within a single cfc instance also makes it very easy to integrate homePortals into existing applications or even other frameworks. This way you can have your application driven by your framework/non-framework of choice and still leverage the layout rendering features of HomePortals.

I already mentioned that the new API lets you do everything programmatically (previous versions required a lot of XML files). To give an idea of what kind of things it lets you do here is a brief cfm template that renders a three-column layout and places a small RSS feed reader on each one.

Note: For the purpose of this example, lets assume the following template is located at /testPage/index.cfm

<cfscript>
   // initalize homePortals    
   application.homePortals = CreateObject("component","homePortals.Components.homePortals").init("/testPage/");
   application.homePortals.getConfig().setContentRenderer("rss","testPage.rss");

   
   // declare modules    
   feed1 = {
         moduleType = "rss",
         href="http://www.oscararevalo.com/rss.cfm",
         title="Oscar Arevalo's Blog"
      };

   feed2 = {
         moduleType = "rss",
         href="http://www.railo.ch/blog/rss.cfm?mode=full",
         title="Railo Blog",
         maxItems="3"
      };

   feed3 = {
         moduleType = "rss",
         href="http://www.dzone.com/links/feed/frontpage/rss.xml",
         title="DZone.com",
         maxItems="10"
      };
   
   
   // assemble page    
   oPage = createObject("component","homePortals.Components.pageBean")
         .init()
         .setTitle("My News Page")
         .setSkinID("rounded")
         .addLayoutRegion("col1","column")
         .addLayoutRegion("col2","column")
         .addLayoutRegion("col3","column")
         .addModule("mod1","col1",feed1)
         .addModule("mod2","col2",feed2)
         .addModule("mod3","col3",feed3)
      ;
   
   // load and render page   
   
   oPageRenderer = application.homePortals.loadPageBean(oPage);
   html = oPageRenderer.renderPage();
</cfscript>

<!--- output page --->
<cfoutput>#html#</cfoutput>

I know there are a lot of things to explain here, and I will go by each one of those, but I think this gives an idea about the "feel" of what can be done programmatically in 3.1.

On the next post I'll go over the previous template explaining what is what, and then talk a bit about the Plugin architecture in 3.1

For now I am attaching to this post the necessary files to run the above example. The current beta for 3.1 can be downloaded here. BE WARNED THAT THIS IS A VERY EARLY BETA, SOME STUFF MAY NOT WORK AND MAY CHANGE BEFORE THE FINAL RELEASE!!!

Any kind of feedback is greatly appreciated.

Have fun!

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact Blog Owner