This project is read-only.

How to setup the OBiCMS Framework - Beta 1.3

To get the OBiCMS Framework running in your environment you will first need to setup your Database. We have attached the SQL to generate all the tables, Functions and data required for a simple example of the OBiCMS.


Step Link Usage
Step 1 - Tables OBiCMS SQL Tables This SQL will create and link all the Tables the OBiCMS Framework relies on.
Step 2 - SQL Functions OBiCMS SQL Functions The functions that the OBiCMS Framework will call in the database.
Step 3 - Example Page OBiCMS Example Page A SQL script you can run to insert all the rows required for a simple test page.
Step 4 - Upload Na Upload the OBiCMS.Dll into the Bin folder of your web site and/or reference it with IIS Manager.
Step 5 - Web.Config See below code At least the following need to be added to the Web.config file for the site after the DLL has been placed in the Bin folder or referenced to the site in IIS Manager.
Step 6 - Test /Example.html Go to your site and test the page.

	<add key="JavascriptPackEncoding" value="highascii" />
	<add key="JavascriptPackFastDecode" value="true" />
	<add key="JavascriptPackSpecialChars" value="true" />

  <!-- LocalSQLServer is normally added to all sites by default from the servers app.config -->
  <remove name="LocalSqlServer" />
  <add connectionString="Server=[SERVER];Database=[DATABASE];User ID=[USERNAME];Password=[PASSWORD]" />

    <add name="OBiHTTPTEST" path="*.html" verb="*" type="OBiCMSFramework.OBiHTTPHandler, OBiCMS" />

How to create your Widgets

All you need is a class which inherits the OBiCMSFramework.WidgetBase class and your good to start. There are no bounds to what a widget can do so your free to explorer what works best for your current task.

This is a very basic widget that is set to reload randomly between 10 and 60 seconds, each time it loads it updates the loaded date and also adds to a counter.

public class SimpleWidget : OBiCMSFramework.WidgetBase

        private Int32 _counter = 0;
        // Public Constructors
        public SimpleWidget(String id)
            : base(id)
            // Set the refresh time between 10 and 60 seconds.
            _minRefreshTime = 10000;
            _maxRefreshTime = 60000;

        // Public Methods
        public override List<String> DefaultSettings()
            // This method will be implemented when we make a CMS Editor and will return a list
            // of settings which the CMS Editor will ask the user for, they will then be placed
            // in the Pages settings XML.
            throw new NotImplementedException();

        // Protected Methods
        protected override void LoadWidget()
            _counter += 1;
            _dateChanged = DateTime.Now;
        public override StringBuilder GenerateWidget(BasePage.ContextManager context, BasePage.PageSettings pageSettings, String widgetSettings, System.Diagnostics.Stopwatch timer, Boolean useDiagnostics)

            StringBuilder returnBody = new StringBuilder();

            if (useDiagnostics)
                returnBody.Append("<!-- Started Generating Widget at " + timer.ElapsedTicks + " -->");

            // Some simple text to output on the page.
            returnBody.Append("<span>Counter : " + _counter.ToString() + "</ span><br />");
            returnBody.Append("<span>Date updated : " + _dateChanged.ToString() + "</ span><br />");
            returnBody.Append("<span>Submited? : " + context.GetSession("##Form##").ToString() + "</ span><br />");

            // Each widget gets given access to the pages PageSettings class, this enables the widgets to change
            // areas of the page that it does not have direct access to.
            // See the documentation for more information about the PageSettings class.
            pageSettings.AppendMetaKeywords("Keyword from widget");
            pageSettings.AppendTitle("Page title from widget");

            if (useDiagnostics)
                returnBody.Append("<!-- Finsihed Generating Widget at " + timer.ElapsedTicks + " -->");

            return returnBody;

        public override StringBuilder PostBack(BasePage.ContextManager context, BasePage.PageSettings pageSettings, String widgetSettings, System.Diagnostics.Stopwatch timer, Boolean useDiagnostics)
            // You can put anything you need here :)
            context.SetSession("##Form##", Guid.NewGuid().ToString());
            return GenerateWidget(context, pageSettings, widgetSettings, timer, useDiagnostics);


How to create a new BasePage with your Templates and Widgets.

The heart of a new page is the BasePageSettings table, this is where you put all the information about your page. You also supplie XML data on how your page is constructed.

This is the settings for the Example2.html page included in the setup.

<?xml version="1.0" encoding="ISO-8859-1"?>
   <OBi xmlns:xsi="">
         <template name="ExampleTemplate" id="Example123">
            <template name="Layout Example 1" id="Example456">
               <template name="NameOfTemplateExample3" id="Example012">
                  <widget name="SimpleWidget1" type="ExampleWidgets.SimpleWidget, ExampleWidgets" id="$$#SimpleWidget#$$" />

Handy methods to show you the status of the OBiCMS Framework.

Going to the following page and supplying it with a job will fire the admin task.


Example : /OBiCMSFrameworkadmin?job=clear-cache

cms-on, cms-off
Turn the OBiCMS Framework off and on, for what ever reason you may not need the OBiCMS Framework to process requests. Doing so will cause the server to process the requests as normal.

diag-on, diag-off
When making a new page it's important to see what parts of the page are slowing down the overall process. The OBiCMS Framework will process the BasePages and Templates in under 20,000 ticks : 1ms. If your a speed freak or want to see what's slowing down your pages then turn on the Diagnostics to get the templates and widgets to output there Diag information.

Note : This only works if the Widgets you make take advantage of the "useDiagnostics" Boolean that gets passed to them. We suggest you add comments to the output if the Boolean is set to true as frequently as needed to help spot potential performance bottle necks.

Because Widgets are reloaded using delegates any errors are not seen by the user, there can be instances when a widget works on its first load but for whatever reason (usually bad code in the load method) does not on sequential calls. Any exceptions that are raised during this time are placed in the ErrorLog, so if your widgets don't look to be working after they have refreshed be sure to check this log for any errors.

Use this Admin task if you have made changes to the URLRewriteJob table. It simply triggers the list of patterns to be reloaded on the next request for a page.

Because all the BasePages, Templates, CssSnippets, Css Scripts, JavaScript Scripts and Widgets are stored in static lists (for maximum performance), it's handy to see just what's going on. This page will return all the objects that have been loaded into the static lists and also the amount of memory that's being used by the OBiCMS Framework.

This clears out the static lists and cuts all ties to the static objects for the GC to collect.

Note : This clears the list fine but does still take a few min's to recover the memory (even when you force the GC) so if anyone can suggest a better way we would love to hear it :)

Last edited Jul 6, 2010 at 11:07 AM by Cadey, version 14


No comments yet.