• Welcome to KonaKart Community Forum. Please login or sign up.
 

dynamic css - skin rotation

Started by rula, June 12, 2008, 01:26:14 pm

Previous topic - Next topic

rula

Hi KonaKarts,

I saw the news of version2.2.6 in your demo. Wow, super features
The skin-rotation in this demo seems to be very practical for demos.

Please, could anybody disclose the mystery of dynamic ccs-imports.
It seems to me, that I only have to change the tiles.css in the @import of the *.css.

I searched the web and can't find a solution for jsp (server side)
I have seen *.ccs as *.jsp, maybe this could be the way, but where could I find more about this?
Help would be fine.

regards, rula







heidi

Hi,

No magic here...   in skin_style.css there is an import:

/* Import the tile style */
@import 'tile3.css';

All we do is run a simple script that replaces "tile3.css"  with "tile4.css" in this import statement...  then tile4 to tile1, then tile2 to tile3 etc...   We run this little script from cron.

Regards,
Heidi.

rula

Hi Heidi,

aha cron,

1.I will switch the css-import dynamic in the jsp (MainLayout.jsp):

<link type="text/css" rel="stylesheet" href="styles/skin_style.css" />

or
2.I will switch the css-import dynamic in the css (skin_style.css):

/* Import the tile style */
@import 'tile1.css';

I guess, that I could use jsp-tags in css-files, but I'm not sure

It must be a entry in the web.xml like this,

   <mime-mapping>
      <extension>css</extension>
      <mime-type>text/jsp</mime-type>
   </mime-mapping>

that the *.css is parsed by the jsp-engine and so ...
I don't know further.
regards, rula

rula

Hi Heidi,

in MainLayout.jsp I have done this:
<link type="text/css" rel="stylesheet" href="styles/skin_style.css" />
<jsp:useBean id="cal" class="java.util.GregorianCalendar"/>
<link type="text/css" rel="stylesheet" href="styles/tile<%=cal.get(GregorianCalendar.MINUTE)%4+1%>.css"/>

in skin_style.css I have done this:
/* @import 'tile1.css'; */

Now the style rotates every minute between 4 different styles.

I want to rotate the complete view, (style and layout). Layout is fixed in tiles-def.xml by main.layout.
How can I change these main-layout-definition dynamic in the tiles-plugin from struts?

regards, rula

ryan

I don't think that Struts allows you to do that. Maybe what you could do is to modify MainLayout.jsp to put in some divs so that the layout can be controlled through style sheets.

rula

Hi ryan,

I searched and found:

There are two ways to create definitions in tiles:
1.with a configuration-file (tiles-defs.xml)
2.with the tiles-tags form the tiles-taglib in a jsp-file (layout.jsp)

By the second way, it should be possible to create dynamic layouts, alike with styles.
I have no experience with this way, because the configuration-file is good for me to use.

But I think, this could be one way to do this.

I thought, for customers it could be interesting to change the complete view (style and layout) to show the possibilities, like in your demo-version, but it's not a must, when it is too fiddly.

Do you know how to use jsp-variables in css-files to create dynamic styles?
Tomcat don't parses a *.css-file to evaluate the variables for the styles.

regards, rula