The fastest easiest way to get it right.

Making a Public Template

A typical Anromeda system will have a public website and a private admin interface.

The public website must have its own 'template'. A template is at least one PHP document that lays out the overall look and feel of the site. A template usually includes as well images, CSS files, and Javascript files.

When you create a public website, you must create a directory in your 'templates' directory. The example below shows the directory structure for the Andromeda documentation system (which is very simple and only has 4 files in it).

Here is what is going on:

  • The Andromeda documentation is itself an Andromeda application with code 'adocs6'.
  • The tree in the image shows the entire directory tree for the 'adocs6' application.
  • The 'templates' directory is created by Andromeda when the application is built for the first time.
  • The 'templates/adocs6' subdirectory has been added by the programmer.
  • The most important file in the 'templates/adocs6' subdirectory is index.php, this file establishes the look of the site.

A Super Simple Template File

The simplest possible template file, stripped of all DOCTYPE declarations and other stuff looks like this:

<?php
include('androHTMLHead.php');
echo ehStandardContent();
include('androHTMLFoot.php');
?>

Every template must have those three lines in it. The first line loads whatever stylesheets are required by Andromeda and by any calls you have made to cssInclude.

The second line outputs the content that was created in your page.

The third line tells Andromeda to load up Javascript files and the results of any jqDocReady() and jsInclude() calls you have made.

A Complete Example

Here is the full text of the index.php file for the Andromeda documentation site:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel='stylesheet'
     href='templates/adocs6/adocs6.css' />
<link rel='stylesheet'
     href='appclib/src/prettify.css'/>
<script type='text/javascript' src='clib/jquery-1.2.3.js'></script>
<script type='text/javascript' src='appclib/src/prettify.js'></script>
<script type='text/javascript' src='appclib/src/lang-ddyaml.js'></script>
</head>
<body>
<div id='a6wrapper'>
    <div id='a6banner'>
      <a href="index.php" style="float: left;">
        <img src='appclib/logo.png'>
      </a>
      <div id='a6bannertext'>
        The fastest easiest way to <i>get it right</i>.
      </div>
    </div>
    <div id='a6links'>
        <div style="float: left">
        <a href="index.php">Home</a>
        <a href="tableofcontents.html">Documentation</a>
        <a href="downloads.html">Download</a>
        <a href="credits.html">Credits</a>
        <a href="contact.html">Contact</a>
        <a href="index.php?gp_page=x_login">Login</a>
        </div>
        <div style="float: right; font-size: 80%">
        <form style='display: inline' action="index.php">
        <input type="hidden" name="x6page" value="search" />
        <input type="submit"  value="Search: " 
               style="border: 0; background-color: white;" />
        <input style="border: 0; background-color: silver;height: 15px;"
                       name="search"></input>
        </form>
        </div>
        <div style="clear:both"></div>
    </div>
    <div id='a6body'>
        <?php echo ehStandardContent()?>
    </div>
    <div style="clear:both"></div>
    <div id='a6foot'>
        <a href="index.php">Home</a> | 
        <a href="tableofcontents.html">Documentation</a> | 
        <a href="downloads.html">Download</a> | 
        <a href="credits.html">Credits</a> | 
        <a href="contact.html">Contact</a> | 
        <a href="index.php?gp_page=x_login">Login</a>
        <br/>
        Andromeda © Copyright 2004-2009 by Kenneth Downs, 
        Licensed under the 
        <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt"
        >GPL Version 2</a>
        <br/>
        Andromeda written by Kenneth Downs with contributions by <a href=
        "mailto:donald@donaldorgan.com">Donald J Organ IV</a>
        <br/>
        Several 3rd party pacakges also included, see <a href
        ="credits.html">credits.
    </div>
</div>
</body>
<script>
$('pre.prettyprint').each(
    function() {
        var x = $(this).html();
        $(this).html(x.replace(/\</g,'&lt;'));
    }
);
prettyPrint();
</script>
</html>
comments powered by Disqus
Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2013, Licensed under the GPL Version 2