Working with themes

One of the most powerful feature of CalendarXP is the theme support. Themes are like clothes of the calendar and can be switched back and forth to create different looks in seconds. In addition to using the bundled high quality themes you may also customize your own to perfectly match the tone of your web page.

What's in a theme?

A theme defines all the customizable options that control the look&feel of the calendar, like colors, fonts, sizes and layout. A theme usually consists of 5 parts - don't be scared, it's actually quite simple to deal with them.

As a simplest example the "normal" theme has a normal.js, a normal.css, a plugins.js and a simple calendar tag.

We always suggest you put all calendar related files into a separate directory and set the src of the calendar tags to reference them. This makes them more like a self-contained component and is easy for you to maintain in future.

Implementing/Install a calendar with the specific theme

Usually you'll need to follow these steps:

  1. Opt a theme that you want to use, suppose it's the "outlook" theme.
  2. Copy the calendar engine files from the engines directory to the themes/outlook directory.
  3. Copy the agenda.js file from the HelloWorld demo directory to the themes/outlook directory.
  4. Open the xxxTemplate.htm in your browser to see how the theme looks like.
  5. Pick up the calendar tags from the xxxTemplate.htm and integrate into your own page.
  6. Modify the src property of the calendar tag on your page to have themes/outlook in the path. You don't need to change anything if your page is also located in the themes/outlook directory.
  7. If you decide to put the theme files in a separate location, you'll have to specify the absolute web path in the name & id of the calendar tag.

Note: The location of the theme files is relative to the location of the engine file, it's NOT relative to the web page containing the calendar. Therefore you'd better use the absolute path to avoid confusion if the theme files are located in a different dir. A good sample could be:

<IFRAME width=102 height=100 name="gToday:/cal/themes/supermini:/cal/agenda/agenda.js" id="gToday:/cal/themes/supermini:/cal/agenda/agenda.js" src="iflateng.htm" scrolling="no" frameborder="0">
...
</IFRAME>
...
<LAYER name="gToday:/cal/themes/supermini:/cal/agenda/agenda.js" src="nflateng.htm" background="nflateng.htm">     </LAYER>

Note: If you don't want any agenda or holiday, you may skip step 3. However, you MUST also remove the agenda.js parameter from the name & id of the calendar tag.

 

Switching among different themes

It's quite easy to change the look of the calendar. In most cases, you just need to change the "theme-name" in the name & id properties and copy the relevant files over. Please check out the HelloWorld tutorial for examples. e.g. change the above calendar sample from supermini theme to normal theme with no agenda file:

<IFRAME width=102 height=100 name="gToday:/cal/themes/normal" id="gToday:/cal/themes/normal" src="iflateng.htm" scrolling="no" frameborder="0">
...
</IFRAME>
...
<LAYER name="gToday:/cal/themes/normal" src="nflateng.htm" background="nflateng.htm">     </LAYER>

 

Customizing your own theme

Although quite a few high quality themes have been provided with the release package, they wouldn't cover everybody's favor. So let's brief on how to customize it now.

A calendar comprises 3 sections - top, middle and bottom. They are actually 3 table cells in one vertical column.

We have a diagram here illustrating most CSS used in the theme-name.css file, as following:

The theme-name.js file is another major option store. There are more than 60 options in it. The file is self-documented and you may go through and play with it simply using the Notepad. We only state several important ones here:


Note:

  1. most of the font color (fgcolor) options in the theme-name.js file can be set to ""(empty string) - which has a special effect of making the fonts invisible and disabling any action of that date.
  2. the border of the calendar cell is not implemented in CSS, instead, it's controlled via the box effect, bgcolor and the cellpadding of the gsInnerTable options in the theme. This is to achieve cross-browser effect even on the older browsers like NN4. We have a FAQ on how to customize the border size.


Copyright© 2003-2007 Idemfactor Solutions, Inc. All rights reserved.