I am in the midst of building a custom ASP.NET server control I call skmContentRotator, which is similar in semantics and syntax to the AdRotator control. Like the AdRotator, the ContentRotator has an XML-formatted file that spells out the content to rotate through. The main difference between the two controls is that while the AdRotator randomly rotates through ads, the ContentRotator will rotate through arbitrary content.
In its simplest form, the ContentRotator would just allow vanilla HTML markup to be emitted. Of course, ideally the control would allow for the content to be dynamically determined; for example, if you wanted to display some random welcome messages, you might want to include the current date/time, or the name of the currently logged on user. Or if you ran an eCommerce site you might want to randomly display “hot deals,” which might entail displaying information about a random product from a subset of products (where the product information was stored in a database).
What do you think would be the best way to allow for this dynamic capability? Right now, I'm leaning toward having any dynamic capability required to be wrapped up in a User Control, and then the page developer would reference the path to the User Control in the XML file that spells out the content to rotate through. That is, say one of the random pieces of content you wanted to rotate through was a page that had a DataGrid with some products listed. To accomplish this, you'd first create a User Control - call it RecentProducts.ascx - that had the required Web controls and source code. Then, in the content file you'd add an item like:
<content contentPath=”~/RecentProudcts.ascx” />
On the other hand, if you just wanted to squirt in some static text into the rotation, you'd add a content item like:
<content>
static text
</content>
Any comments on this approach? Are there any features for a content rotator you can think of that are must-have? Any comments/suggestions appreciated.