Creating a theme for XatafaceXataface 0.7 allows you to easily develop, distribute, share, and install your your own themes
As we have seen from the earlier sections of this tutorial, Xataface's look and feel is extremely flexible and customizable. Here we will explore ways to reuse your customizations and distribute them in a a theme. What is a theme?Wikipedia explains this nicely:
In Xataface, a theme is essentially a set of templates, stylesheets, and images that alter the way a Xataface application looks. Making your own themeAll themes share a common basic directory structure. For example, it we wanted to make a theme named mytheme, would create a directory as follows: mytheme/ Your theme directory has a single sub-directory named templates where all of the templates used by your theme are stored. You can override any template in the Dataface/templates directory by simply placing a template of the same name in your theme's templates directory. Most themes will start off by overriding the Dataface_Main_Template.html template since it is used for every page in a Xataface application. A good way to start would be to copy the Dataface/templates/Dataface_Main_Template.html template into the mytheme/templates directory, then start making modifications. There are certain slots and blocks (the {define_slot} and {block} tags) that you will want to maintain in order for your application to work properly, but you are essentially free to change the template at will. Your theme directory structure will look like: mytheme/ Installing Your ThemeInstalling your theme into one of your applications is easy.
Now if you start up your application, you'll see that it is using your custom theme. Uninstalling Your ThemeUninstalling your theme is as easy as commenting out the portion of the conf.ini file where you added your theme:[_themes] Adding Your Own Stylesheet
Adding Images and Other ResourcesMost themes will include some images, icons, or perhaps sounds and movies. To include these in your theme you can place them anywhere in your mytheme directory, so that they can be easily distributed with your theme. Since your theme will always be located inside the themes directory for any application, the resources can easily be referenced from the theme's templates using the {$ENV.DATAFACE_SITE_URL} variable - which will always point to the application's directory. e.g. If we create an images directory in our mytheme directory, and we could refer to images in this directory from a template using: <img src="{$ENV.DATAFACE_SITE_URL}/themes/mytheme/images/img1.jpg}"/> etc..
|