tags:

views:

205

answers:

5

I'm doing a e-commerce type of website, and it has a CMS wherein the admin user could create themes and change current theme design. I use jquery. the style/theme properties are stored in database and retrieved to an xml.

and i use jquery to manipulate the CSS properties of the page using the xml's properties..

is this the practical way of doing dynamic themeing/ styling? thanks.

A: 

jQuery UI - http://jqueryui.com/themeroller/

The library provides a standard set of widgets and effects you can use to build your UI. It also supports multiple themes.

HyperCas
i mean i want to let the end users do the design
bgreen1989
A: 

Why aren't you doing theming on the server like most CMSs do it ? Not sure I understand the practicalness of downloading dynamic re-theming code to the browser when you could be simply sending the appropriate css.

You also need to consider the case of no-javascript available in some browsers as well as being very dependent on the speed of the browser and user's pc to run this stuff. core 2 duo might theme itself nice and quick, but my atom-based netbook isn't so swift

Scott Evernden
the theme properties are stored in database actually. we are using java servlets, and jsp.
bgreen1989
+2  A: 

IMHO, no.

If you want to let users have full reign over the CSS on your website, I'd probably let them upload their own CSS files, and just list them in the DB. Choose the appropriate file server-side and load that. No messy "flash of unstyled content" or JS dependencies.

If you only want to let the users edit a few specific elements, then perhaps you can store those specific elements in the DB, but you should still dynamically generate the CSS file (via PHP or what have you) and send that over to the client.

Oh, and why are you using XML at all? You're just adding an extra layer of complexity for no good reason at all, as far as I can tell.

Mark
A: 

As others have already commented, if you want the admin to have full control over the styling of the site (as most popular CMSs provide) then you need to allow the admin to upload their own style sheets or even html templates. You could also include several pre-made style sheets and templates for users who can't or don't want to create their own.

I know that some web services like LiveJournal and Xanga have restrictive theming systems that only allow users to change the colors and font styles of their personal pages. But IMHO this type of theming system would not be appropriate for business sites. It gives the site admin too little control over the look/layout of their site. No matter how great your core template is. If all you let your users do is change some colors and font styles around, then you'll still just end up with a bunch of cookie-cutter sites that all look pretty much the same.

At the bare minimum, the admin should be able to apply their own CSS template to the store so that, if the business decides they want a professionally designed layout, they can implement one on their site.

What you can do however, is to include with the CMS a CSS generator for those admins who don't know how to write their own CSS. It could just be a wizard interface that walks the user through a step-by-step process to generate a basic custom style sheet.

Calvin
thanks... now..i need to re-think again my logic in able to apply the CSS generator stuff...:'((
bgreen1989
+1  A: 

On a site I worked on I started off doign odd/even table row styling with jQuery because the syntax is trivial as well as some other table styling. But then for larger tables I began perforamnce testing it and on Firefox 3 (which is reasonably performance for the modern browsers) I was spending as much as 200-500ms (according to YSlow) rendering the page, which is unacceptably high.

You want to do as much as you possibly can on the server--basically anything you can do on the server while rendering the page you should. It'll be much quicker that way.

Save jQuery for the things you can't do on the server.

cletus