It means there will be a separate CSS file for each user. This will impose
heavy load on the application, and where is database involved in that case, as
i want to save and load css styles from database ?
Is there any other way to do that ?
Can we make CSS file dynamic e.g. body{background: {$color};} and then modify
that color variable in our javacode (like inPHP) ?
________________________________
From: Russell Simpkins <[email protected]>
To: [email protected]
Sent: Wednesday, July 22, 2009 6:23:09 PM
Subject: RE: Save CSS/StyleSheet in Database ?
I have not done this myself, but I think you might get what you want using the
SimpleAttributeModifier. Say you were doing a css style:
<link rel="stylesheet" type="text/css" href="css/standard.css"
wicket:id="userStyles:/>
Then in your javacode you can have:
userCss.add(new SimpleAttributeModifier("href", "css/" +
LOGGEDINUSER.getUserId() + ".css"));
You could always do something similar in javascript with cookies.
Russ
> Date: Wed, 22 Jul 2009 05:12:45 -0700
> From: [email protected]
> Subject: Re: Save CSS/StyleSheet in Database ?
> To: [email protected]
>
> Thanks for quick response.
> Obviously, styles can be loaded from database after Login. But i want to make
> a separate css file and dont want ot add it in the java code, for sake of
> simplicity.
>
> Is there any way to store css styles directly from css file for a specific
> user, and then load styles directly to css file after user Login ?
>
> Or can we make css file dynamic by introducing variables in it (like in PHP) ?
>
> Thanks...
>
>
> ________________________________
> From: Mathias Nilsson <[email protected]>
> To: [email protected]
> Sent: Wednesday, July 22, 2009 4:59:53 PM
> Subject: Re: Save CSS/StyleSheet in Database ?
>
>
> You would probably have to use cookies to save which style the users would
> have. There is no way knowing this without login or cookie.
>
> There are probably a better way of doing this but if you save style and
> classes in a database like this
>
> *{ font-family: verdana; } // a row in the database
> a{ color: red; } // a row in the database
>
> you could implement the IHeaderContributor and override the renderHead
>
> public void renderHead(IHeaderResponse response) {
> StringBuffer buf = new StringBuffer();
> buf.append( "<style type=\"text/css\">" );
> buf.append( "*{ font-size: 9px; }" );
> buf.append( "</style>" );
> response.renderString(buf);
> }
>
> of couse you should the get it from a service or directly from a dao.
>
> public void renderHead(IHeaderResponse response) {
> BradningService service = getBrandingService(); // get this using
> @SpringBean or whatever
> List<String> styles = service.getStyles( user ); // get the style for a
> user
> iterate here and add the style
>
> }
>
>
> --
> View this message in context:
> http://www.nabble.com/Save-CSS-StyleSheet-in-Database---tp24604324p24604928.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
_________________________________________________________________
Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
http://windowslive.com/Online/SkyDrive?ocid=TXT_TAGLM_WL_CS_SD_photos_072009