logo





GradeBook released!
Oct, 2008
Solstice adds a grade book to its toolkit!

New Versions!
April, 2008
A new version of all our software is available!

CommonView Released
April, 2008
Check out our latest collaborative tool.

RESTful Web Services
Jan, 2008
Solstice provides support for RESTful development.

How to create a skin

There are three things that need to be done when building a skin.

The first step is to create a view object. This will set the template and pass any extra parameters to it (ie date, logo, etc). The simplest view object only needs a new method.

Perl
package Grau::View; use strict; use warnings; use 5.006_000; use base qw(Solstice::View::Boilerplate); use constant TEMPLATE => '/grau/template.html'; use constant APPLICATION => 'Themes'; sub new { my $obj = shift; my $self = $obj->SUPER::new(@_); my $app_config = $self->getConfigService(APPLICATION); $self->_setTemplatePath($app_config->getAppTemplatePath()); $self->_setTemplate(TEMPLATE); return $self; } 1;

The APPLICATION constant in the example is the application namespace that will contain the package, and is needed so that Solstice can locate the template directory.

This file will live in the lib/Grau/ directory in the Themes application. The actual file name is up to you, and for this example we used View.pm.

If you wish to get fancier with your boilerplate (ie you want to pass in lots of dynamic data to it) please refer to How to create a Solstice application.

The second thing to do is to actually create your template. The most basic template only needs one line:

Perl
<!-- sol_var content -->

This line will get all of your application content painted onto the screen. Place any additional content in your template at this point. Any parameters you have passed into your template can be used here also. Solstice also provides a built in messaging service. If you wish to utilize it simply tell your template where you want the messages to be displayed.

Perl
<!-- sol_var messaging_pane -->

This is an example of what your basic skin template might look like.

Perl
<!-- HEADER --> <table class = "header" cellpadding="0" cellspacing="0"> <tr> <td class="logo"> <img src="<!-- sol_var image_path -->"> </td> <td class="date"> <!-- sol_var current_date --> </td> </tr> </table> <!-- END HEADER --> <!-- sol_var messaging_pane --> <!-- BEGIN APPLICATION WORKSPACE --> <!-- sol_var content --> <!-- END APPLICATION WORKSPACE -->

If you would like more information on how to use messaging and what it is please look at How to use MessageService.

The final step is to open config.xml in a Solstice application and locate the boilerplate_view attributes on any <url/> elements. For this example we will change the value of these attributes to:

XML
<url ... boilerplate_view="Grau::View" ... />

Now we have configured our application urls to use the Grau::View boilerplate.

Most skins will need some sort of css or javascript. You can use our Solstice::IncludeService to add these files in the Grau::View object.