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 "supermini" theme has only 3 parts - the supermini.js, supermini.css and a simple calendar tag.

More complicated examples like the "outlook" theme have more - outlook.js, outlook.css, plugins.js, button images and the calendar tags, as following:

<iframe width=152 height=163 name="gToday:outlook:agenda.js" id="gToday:outlook:agenda.js" src="ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; left:-500px; top:0px;">
<LAYER name="gToday:outlook:agenda.js" src="npopeng.htm"> </LAYER>
</iframe>

Some extra functions are defined in the plugins.js to emulate the internal dropdown selector.

Implementing a calendar with the specific theme

Generally, you'll need the following steps:

  1. Opt a theme that you want to use, suppose it's the "outlook" theme.
  2. Go to themes/outlook dir and pick up the calendar tag(s) from the outlook.htm.
  3. Append those tags to the very bottom of your page, tightly above the <body> tag.
  4. Adapt the "src" property of the calendar tag to point to the location of the engine file, e.g. src="/myweb/engines/iflateng.htm".
  5. Copy the theme files (.js, .css, graphics and plugins.js) to the same directory /myweb/engines/. If you place them somewhere else, you'll have to specify the absolute web path in the name & id properties.
  6. Setup the gfPop.fPopCalendar() function in the onclick events of HTML tags so that it can be triggered by the user.

Note: The location of the theme files are all relative to the engine file. It's not relative to the web page showing the calendar. Thus, you'd better use the absolute path when they are located in a place outside the engine directory to prevent confusion. 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="ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; left:-500px; top:0px;">
<LAYER name="gToday:/cal/themes/supermini:/cal/agenda/agenda.js" src="npopeng.htm">     </LAYER>
</IFRAME>

Switching among different themes

Now, it's quite easy to change the look of the calendar. In most cases, just change the "theme-name" in the name & id properties and copy the relevant files to the engine dir (or wherever you theme sits) will do. Please check out the HelloWorld tutorial for examples.

Trick - you may also get it switched by overwritten the current theme with files from another theme but using the current theme name. It could save you a lot of work since the calendar tags in your web page doesn't need to be changed. It's especially useful when you have many calendar pages in your project.

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 place to check. There are more than 60 options in it. The file is self-documented and you may go through and play with it simply with the Notepad. I won't cover all of them, but only several important ones:

Other common options are:



Copyright © 2001-2003 CalendarXP.net, Liming Weng