Throughout the ES Designs website, I have made references to Frontier. Frontier is a powerful scripting platform for the Macintosh developed by UserLand. Frontier and the UserTalk language build on AppleEvent technologies to allow complex interactions between applications. UserTalk provides a stage for controlling both the operating system and programs running on it. At the same time, Frontier provides a built-in database for storing a variety of objects including, text documents, outlines, scripts, graphics, and data.
This combination of a powerful scripting language, complex interactions with other programs, and the built in object database, make Frontier a remarkable tool for developing websites and web applications. The ES Designs site resides almost entirely within the Frontier object database. Most of the style and formatting that you see is generated by Frontier. All of ES Designs' web applications are developed within Frontier using build-in capabilities or interactions with other programs.
Frontier's power is more than a little daunting at first. It has a steep learning curve. The documentation, though is improving, is still weak and often leaves you hanging and wondering what to do or where to go next. But because Frontier is so essential for this site and ES Designs other tools, I thought, I would put together a little description of how Frontier is used to set up and maintain a website.
Frontier website Basics
There are five main pieces to a web page in Frontier. These are document text, directives, page templates, glossaries, and macros. A web page and site are constructed from these five elements.
Starting with the document text, Frontier builds the page according to information stored in directives. One directive points to a page template that controls text placement on the page. The document text is incorporated into this template to ensure a consistent appearance throughout a site. A glossary stores links to other pages on the site or externally. These links are added to the document text whenever a glossary item is referred to in the text (typically through simple substitution of the link for the glossary reference). Finally, macros are small scripts that generate html text that is inserted into the document and template.
The final html document that a user sees in a web browser can be quite distinct from the original document text. For example, the document text for this page contains no html coding. All of the formating that you see is the result of directives, the page template, glossary links, and macros. Walking through this page should give you an idea of how a website is constructed with Frontier.
Directives
Starting at the top, the document text for this page contains two directives, "#title" and "#paragraphStyle " style. The first directive is a essential directive that all pages need. It provides page with its title, in this case, "Website Scripting and Frontier". The second directive is a custom directive that I added. It tells Frontier to run a script while processing the page that inserts html tags to embolden the first three words of each paragraph. By setting up this directive and script. I can type "#parargraphStyle "bold, 3"" once at the top of the page and do not have to manually insert bold tags into each paragraph.
An important point here is that it is easy to add custom directives for your website. Frontier processes any item that begins with a "#" as a directive and stores the information that the directive contains in the object database as the page is being processed. Once the information is in the database, you can write a script that processes it and generates html accordingly. I use two other custom directives in with this site. The "#banner" directive tells Frontier to add a graphic at the top of each page and provides the URL to that graphic. The "defaultName" directive tells Frontier what the default name for the top page of the site. This is used in generating the navigation bar a the bottom of the page.
Other standard directives include "#template", "#ftpSite", and "#bgcolor". These tell Frontier what template to use, where to upload the page after rendering, and what the background color should be. These directives are stored in a subtable of the object database that contains the document text. Placement here allows these directives to act globally on all of the document text stored within the same table.
Templates and Macros
Templates provide html code that give a page its general appearance. It is essentially a form that the document text is placed into. On this page, everything above and below the horizontal lines at the top and bottom of this text (including the lines) is generated by the template. The template also contains macros that add html text to the page.
The template for this page contains a number of macros. Macros are delineated using curly brackets {}. Text within the curly brackets is processed as a Frontier script with results pasted into the page in place of the macro.
For this page, the top of the page template has a macro that calls a script named pageheader(). This script generates the html text needed at the top of a page. This includes the opening <HTML> tag and opening and closing TITLE tags (plus the page title between them). I have modified this pageheader script to also generate an image reference that inserts the logo across the top of the page. The macros on the template return text that shows when the page was last modified as well as my name, the copywrite date, my email address and the closing </HTML> tag.
There is one other custom macro on the template which calls the script Navbar(). This script uses data collected from directives and an outline of the site structure to build the navigation bar at the bottom of the page. The navBar script returns glossary references to adjacent pages (stored in the same subtable as this page) and pages above it in the site hierarchy. For this page, the "flat links" point to the tutorial on the "Graphic Logs from Resolve Spreadsheets" and the "vertical links" point to the tutorial page and the ES Designs home page.
Glossaries
You may have noticed that the navBar macro returns glossary references and not hard coded html links. This is done to utilize the power of the glossary. The glossary is a table the contains information on links. Glossary table entries typically contain html links or image references and each entry is named (typically the page title or file name). To insert a glossary entry into your document text, you simply make a quoted reference to the entry's name.
The glossary table provides a single location for all of your links. If you need to change a link, you can make the change in the glossary table, and not at every location where the link sits in your final html text.
Site Structure
A final important aspect of websites built in Frontier is the site structure. The entire website is stored within a table in the object database. The structure of the site is determined by the substructure of this table. Document text stored in a the top level of this table is used to generate files at the root level of the website. Document text stored in subtables will generate files in subdirectories of the website.
Directives for each page are inherited from the tables above it. Directives stored in the top table of the website are applied globally to all pages in that table and in subtables. These root directives can be overwritten by directives in subtables and on pages. Some directives, such as the #title directive are stored with each page and as such are unique to that page. Other directives, like #ftpSite are usually applied to the entire site, so are stored in the root table. Inheritance of directives gives you a great deal of flexibility in developing an interesting, but consistent interface to your website.
Closing Notes
This page provides an overview of how Frontier is used to build web pages and websites. It focuses on what I think are the important elements of the process. Frontier provides a framework for generating websites with very little html coding. At the same time, the process is open to customization, allowing you to build and maintain distinctive websites.
For more information on using Frontier for websites, check out UserLand's Website Building with Frontier page.