Themelia Pro A powerful new development platform built on ASP.NET.
 
Creating Multiple Versions
 
 

Since sequences are superposition pages, they can be used in many different scenarios. One of the ways you can use a sequence is to return multiple designs of a page to a user. For example, if you have design A with one logo and design B with a different logo, you may want design A and design B to be randomly shown to different users to tell which logo is more successful in reaching some sales goal.

In this type of scenario, you may have the following configuration:

<sequences>
    <add name="ProductB">
        <views>
            <add name="DesignA" />
            <add name="DesignB" />
        </views>
    </add>
</sequences>

Then, in your sequence page SelectInitView method, you would have something that would randomly select a design (putting your own logging in there as well):

//- @SelectInitView -//
public override String SelectInitView()
{
    return "Design" + ((DateTime.Now.Ticks % 2) == 0 ? "A" : "B");
}

While this works well for a single pages having multiple designs, what about a superposition of pages having multiple designs? For this we have sequence versions.

To calibrate our discussion, let's start out with the following configuration:

<themelia.web>
  <sequences>
    <add name="CheckOut">
      <views>
        <add name="Shipping" />
        <add name="Personal" />
        <add name="Billing" />
        <add name="Confirmation" />
        <add name="ThankYou" />
      </views>
    </add>
  </sequences>
</themelia.web>

As a reminder, the above will automatically map the to following controls:

//+ sequence
/Sequence_/CheckOut.aspx

//+ view 
/Sequence_/CheckOut/Shipping.ascx

/Sequence_/CheckOut/Personal.ascx

/Sequence_/CheckOut/Billing.ascx

/Sequence_/CheckOut/Confirmation.ascx

/Sequence_/CheckOut/ThankYou.ascx

For this checkout sequence, let's say that our marketing department came up with three different designs for the billing and confirmation views. These designs go beyond the look and feel from the graphics design department. Some of the changes include addition of various controls. For our discussion, all we need to know is that we are calling these DesignA, DesignB, and DesignC.

Given the fact that two of the views now have two three different views, it follows that more physical controls are required. With our new requirements, instead of using /Sequence_/CheckOut/Billing.ascx to hold the Billing view, you use make "Billing" a folder (and the same for Confirmation), and use the following controls:

//+ sequence
/Sequence_/CheckOut.aspx

//+ view 
/Sequence_/CheckOut/Shipping.ascx

/Sequence_/CheckOut/Personal.ascx

/Sequence_/CheckOut/Billing\DesignA.ascx
/Sequence_/CheckOut/Billing\DesignB.ascx
/Sequence_/CheckOut/Billing\DesignC.ascx

/Sequence_/CheckOut/ConfirmationA.ascx
/Sequence_/CheckOut/ConfirmationB.ascx
/Sequence_/CheckOut/ConfirmationC.ascx

/Sequence_/CheckOut/ThankYou.ascx

Having created the new controls, we now just need to tell Themelia Pro about them. Juts add them to the "versions" collection, like this:

<themelia.web>
  <sequences>
    <add name="CheckOut">
      <versions>
        <add name="DesignA" />
        <add name="DesignB" />
        <add name="DesignC" />
      </versions>
      <views>
        <add name="Shipping" />
        <add name="Personal" />
        <add name="Billing" />
        <add name="Confirmation" />
        <add name="ThankYou" />
      </views>
    </add>
  </sequences>
</themelia.web>

Now when your sequnce is first accessed, a design will be selected and as the user navigates around the sequence, he or she will be shown the previously selected design. If there is no design available, the base view will be shown. For example, at first, Shipping.ascx may be shown, then Billing.ascx, then Billing\DesignB.ascx.

Choosing a Design

There are multiple ways of selecting a design.

The first way to do this is the just set the "explicitVersion" attribute on the versions collection. If the version exists, it will be used regardless of any other setting. This setting always takes precidence. If the version does not exist, other methods will be taken.

<themelia.web>
  <sequences>
    <add name="CheckOut" explicitVersion="DesignC">
      <versions>
        <add name="DesignA" />
        <add name="DesignB" />
        <add name="DesignC" />
      </versions>
      <views>
        <add name="Shipping" />
        <add name="Personal" />
        <add name="Billing" />
        <add name="Confirmation" />
        <add name="ThankYou" />
      </views>
    </add>
  </sequences>
</themelia.web>

Assuming the explicitVersion is not set or the version set doesn't exist, you have the option of dynamically choosing which version you want in the SelectVersion method of your sequence page. Here's an example:

namespace Sequence
{
    public partial class CheckOut : Themelia.Web.Controls.SequencePage
    {
        //- @SelectInitView -//
        public override String SelectInitView()
        {
            return "Shipping";
        }
 
        //- @SelectVersion -//
        public override String SelectVersion()
        {
            return "Design" + ((DateTime.Now.Ticks % 2) == 0 ? "A" : "B");
        }
    }
}

If the selected version doesn't exist, then a random design is selected on sequence start-up.