umbraco.library:RegisterStyleSheetFile(String key, String url) might be useful, but you could also just use a content area placeholder in a template that inserts into the head of the master template?
I guess a simple macro that reads a GET parameter and puts it into the master template would do the trick.
If you have a conChange event on a dropdown-box that reloads the page with a GET parameter that indicates which stylesheet has been chosen. Then the macro must read this GET parameter and write the value in the master template. If the GET parameter is not present, write a default stylesheet.
If you're dealing with membership and personalization you will want a property of the member that stores which stylesheet to use
I would tackle this using /Base so that I could set and change the stylesheet dynamically (using alternate title for the various themes http://www.w3.org/Style/Examples/007/alternatives). So, your Ajax call updates the member and then you use JS to switch/set the stylesheet (both onload and onchange).
now i am an umbraco newbie, so i have no clue what i am talking about.
from a skinning point of view the suggestions above make sense, but i think it probably depends what you ae after. i am building my first [simple] site in umbraco and i spent a little wile looking at the dynamic CSS thing. My needs are slightly different, as all i want to do is to allow the CMS admin user to select different graphics to display in the background.
for example select an image for the homepage which needs to be displayed as the background allowing for txt to go in front.
as my needs are simple, i have gone with inline style tags. i know this is a compromise, and i will probably end up with writing a style block into the head of the page to control those few elements.
if there is a better way of generating these within Umbraco i would also be intersested
Dynamic CSS
I think there was a thread (maybee in the old forum) about this a long time ago but i can't seem to find it.
Is it possible to "dynamically" choose og change the stylesheet used by a template ?
Hi Mikael
What decides which stylesheet to use?
/Thomas
umbraco.library:RegisterStyleSheetFile(String key, String url) might be useful, but you could also just use a content area placeholder in a template that inserts into the head of the master template?
Dan
Sorry i was i bit unclear in my original post.
Basically i wnat something that resembels "skinning" where the user can select a different layout / color scheme for a page /site.
So the deciding factor is some kind of userinput that is not yet defined in detail.
I guess a simple macro that reads a GET parameter and puts it into the master template would do the trick.
If you have a conChange event on a dropdown-box that reloads the page with a GET parameter that indicates which stylesheet has been chosen. Then the macro must read this GET parameter and write the value in the master template. If the GET parameter is not present, write a default stylesheet.
Does this make sense?
/Thomas
You probably have to save the selected stylesheet in a session or something to make sure the selected stylesheet stays active.
Couple of things here...
Nik
Thanks for all your input. I'll dig into your suggestions and see what i can get from them.
now i am an umbraco newbie, so i have no clue what i am talking about.
from a skinning point of view the suggestions above make sense, but i think it probably depends what you ae after. i am building my first [simple] site in umbraco and i spent a little wile looking at the dynamic CSS thing. My needs are slightly different, as all i want to do is to allow the CMS admin user to select different graphics to display in the background.
for example select an image for the homepage which needs to be displayed as the background allowing for txt to go in front.
as my needs are simple, i have gone with inline style tags. i know this is a compromise, and i will probably end up with writing a style block into the head of the page to control those few elements.
if there is a better way of generating these within Umbraco i would also be intersested
is working on a reply...