Designing a templating system

Source: Internet
Author: User
Tags transparent image

Source: http://www.imcoder.org/architecture/187178.htm

 

Q:

Hi,

I am in the process of designing an ecommerce store and the client wocould like to offer a "white label" solution so that their affilaites can run their own stores, populated form a central database.

We need the ability for affiliates to design their own "templates" and have the application consume them and herge with the data at runtime. we have tried doing this in the past using regular expressions but it was incredibly slow.

Ideally, the user wocould be able to upload HTML templates to a dabase which wowould look a bit like this...

 

<Html>
<Head>
<Title> Ecommerce Example </title>
</Head>
<Body>
<Div ID = "Header"> Header Goes Here </div>

<ECO: Products Show = "20">
<ECO: ItemTemplate>

<Div> <B><% = Product. Title %></B>-<% = Product. Price %></Div>
<P><% = Product. Summary %></P>

<A href ="<% = Product. URL %>"> More Info </a> | <a href = ""<% = Product. AddURL %>"> Add To Cart </a>

</ECO: ItemTemplate>
</ECO: Products>

<Div ID = "Footer"> Footer Goes Here </div>
</Body>
</Html>

 

Obviusly there wocould be composed parts of the page that need database content, including the category menus, best sellers, mini-basket etc so they wowould be big pages and it wowould need to be very quick.

The best example I have seen of somebody doing soemthing like this is here-http://www.liquidmarkup.org/-They even seem to have implemented looping and branching constructs!

Anyway, I have a vague idea where to start but I'm slightly out of my depth and wondered if anyone had done this before, or come into ss a commercially available solution to this?

Any help wowould really be appreciated.

Jon

A:

Am I the only person that has tried doing this?

Jon

A: The best solution for this wocould be to use XSL.:

OK, I 've done a little bit more digging.

XSLT looks like a possible solution but isn' t Special easy to write.

I don't have the technical knowledge to write something that will parse templates so writing my own language like Liquid Markup is not going to happen.

I 've been looking into the new MVC engine and it looks like it may be a possibility. I don't want my users to have to write aspx templates as that kind of defeats the point so I 've been looking into things like Nvelicity, Brail and StringTemplate. it's all ver confusing though so any advice wocould really help from people who have had to do this before.

 
Jon
 

A:

Jon,

Did you ever come up with a solution for this (or does anyone have some real input )?

I need to do something like this too.

Thanks

TIM

A:

Hi,

I have created a simular system, I used png semi transparent image to do the layer presentation "a sort of dark black rounded panel at Opacity 65%-70% ", and simply change the background based on the customer, it is very cute, professional finish and very re-usable, but one thing is that to obtain full performance with UI fonctionnality you need FireFox, because Javascript Stuff on IE is slower than FF.

And during the production, I was very happy to be able to change the atmosphere every week!

A:

 

Hi Jon,

Although disimilar to the Ruby (as suggested), is dependent on two elements I. e. that of UI and behaviour. A templating system can be easily built in asp.net for function such as storefront, however you will still need to provide a rich set of library for user to extend each element of the system, rather then being able to modify its UI.

A few examples I can point out are here

Control http://www.devx.com/dotnet/Article/18011 (control approach)

Http://msdn.microsoft.com/msdnmag/issues/02/01/cutting/ (using templates in the actual controls you can change things dynamically .. a bit difficult but good approach)

Http://weblogs.asp.net/scottgu/archive/2006/06/04/Supporting-Templates-with-ASP.NET-User-Controls.aspx

Http://www.devarticles.com/c/a/ASP.NET/Easy-ASP.NET-Page-Templates/1/

Http://www.csharphelp.com/archives2/archive383.html (a general idea)

Http://aspalliance.com/articleViewer.aspx? AId = 91 & pId =

Or simply design something similar to these http://msdn2.microsoft.com/en-us/asp.net/aa336613.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.