SEARCH:

Templates

Andromeda follows a set of conventions that are taken from the Joomla! Content Management system. We do this for the simple reason that it lets us use Joomla! templates for the "public face" of Andromeda applications. You do not have to use Joomla! templates of course, you can take your own designs and put them into this format and use them.

By templates we do not mean something like Smarty, where you make a non-PHP page to lay out a single page. Andromeda uses the word in the same sense as most of the web industry, to mean a main HTML page and supporting CSS and possibly JS files that give the site its overall look and feel.

Setting The Template

If you have more than one template, you have to explicitly tell the system which one to use. One very common approach is to use the default Andromeda template for people who are logged in, and to use some specially designed template for visitors to a site. This gives your site two different "faces", a public face and a private face.

You can achieve that effect by putting the file "applib.php" into your application directory and putting the following code into it:

<?php
// This code goes at the top of 'applib.php' in 
// your application directory.
if(LoggedIn()) {
    // Logged in users should get the Andromeda
    // default template
    SessionSet('TEMPLATE','rt_pixel');
}
else {
    // public users get the other template
    SessionSet('TEMPLATE','sexy_branded_template');
}
?>

Required Andromeda Styles

Whether you are providing your own files, or using a Joomla template, you should copy the file "x2.css" from the default Andromeda template, "rt_pixel", into your new template, and modify the styles as necessary to maintain uniformity.

A Non-Joomla Template

Each template goes into a subdirectory of the application's "templates" directory, even if there is only one template.

Andromeda expects to find the file "index.php" at the root level of the template. This is the master file for the template.

The template should have a function call to mosMainBody in the main content area. Other content areas, such as sidebars, header and footers, and so forth are called "modules" (not to be confused with database modules). Each of those can contain code that more or less looks like the following:

<?php if(mosCountModules('module_x')) { ?>
    <div id="module_x">
        <?=mosLoadModules('module_x')?>
    </div>
<?php } ?>

Other than that, you can put your CSS or JS files anywhere you wish.

Using a Joomla Template

To use a Joomla template, unpack it into the templates directory of the application.

As of this writing, October 2007 we cannot say for sure that we have aliased every function you will find in a Joomla template. In most cases we have to use a little trial-and-error to find function calls in the template that are not being handled.

The biggest job in adopting any Joomla template usually has to do with the menu. If the menu is making direct database calls to the Joomla database then it simply will not work. Cases like this usually require a hard-coded menu be supplied to the code.