Up and Running with Frontier Web Site Management
by Matt Neuburg
Author of the book Frontier: The Definitive Guide
Up until now, every time we have looked at Frontier's output in our browser, we have done it through the Preview Page command. This command, however, is useful only up to a point.The HTML documents that it makes are placed into folders in a sort of catch-all folder called Websites, in the same folder as Frontier itself; this folder (Websites) is really just a temporary holding place, and you should throw it away from time to time. A "real" rendering of your site would go into a folder you specifically designate with #ftpSite.
Even more important, "real" rendering gives you a way to render your entire site at once.
And we are coming now to some features of Frontier's Web site management that really make sense only in terms of the site as a whole, so it would drive you mad to have to render the site one page at a time.
"Real" rendering of this kind is called "publishing". It is a little more work than previewing in the browser, but not much. You select a single page and choose Publish Page from the Web menu, or, to render your whole site at once, select anywhere in your site table and choose Publish Table.
But don't try it yet, because first we have to prepare our #ftpSite.
Open the myFirstSite.#ftpSite table and look inside.The #ftpSite.isLocal entry tells Frontier whether or not it is to create the pages onto your hard disk.
(The alternative, corresponding to an isLocal value of false, would be for Frontier to launch your FTP client program, such as Fetch or Anarchie, and instruct it to upload the pages over the Internet as it renders them! This is a very convenient feature when it's needed. However, the Windows version of Frontier apparently doesn't do this yet, so we'll say no more about it here.)
We need now to set the value #ftpSite.folder.
It represents the folder on your hard disk into which Frontier will place the Web pages as they are rendered. A default value has been silently created for you, so that you could start publishing if you wanted to. But now we want to give it a real value.
Unfortunately, it's tough to remember and type an entire pathname accurately, especially when you're looking at it in such a small space. Here is a handy shortcut; it involves talking to Frontier in UserTalk, but hey, UserTalk is good for you.
Go to the Finder [Windows Explorer] and create the folder you want to render into, if it doesn't exist already. Now come back to Frontier and, in your personal menu (the one with your initials), choose Edit Menu. A menubar window appears (it's just a variety of outline, so don't worry, you can cope); create a new item called Folder Path to Clip, and double-click its triangle to open its script edit window.
Make the script go like this:
You can dismiss this window and the menubar window now. From now on, you've got a menu item Folder Path to Clip in your personal menu; this will make it much easier to obtain pathnames of folders. So choose that menu item! In the dialog, select the folder you want to publish into.
Now, tab into the Value column of myFirstSite.#ftpSite.folder, and Paste, replacing the value with what was in the clipboard -- namely, the pathname of your folder.
As for #ftpSite.url, this will be used by Frontier for various tasks where it needs to know the actual URL your site will occupy when it's on the Internet. If you know what this is, you should type it in for the value of #ftpSite.url now. For instance, it might be "http://www.borg.com/mysite/". However, I believe this value is of diminished importance, and that it won't hurt if you don't set it.
Now you can close #ftpSite and forget about it.
We'll try publishing the whole site now. If you have been following along in this tutorial, you've made many changes in our practice site, so let's go back and clean up and take stock for a moment, so that we're working with the same set of documents.You should get rid of all the experimental stuff in the template; in fact, if you like you can just reduce it to the {pageHeader}, {bodytext}, and {pageFooter} lines.
Get rid of all references to {jefferson} and {myTitle} too.
You should have a "default" page whose #title is "Welcome".
You should have a secondPage whose #title is "My Second Page" and which contains a renderObject macro call which embeds thirdPage.
You should have a thirdPage which is an outline, has no #renderOutlineWith directive, and has no #title.
And you should have a fourthPage which is an outline, and has a #renderOutlineWith "tableOutliner" directive, and whose #title is "The Planets".
Now select any line in the first level of the site table (for instance, you could select myFirstSite.default) and choose Publish Table. After checking with you to make sure you really want to do this (and to make sure it's got the right table), Frontier will churn away for a bit, and then put up a dialog telling you it's finished (this may seem silly, but when you have a huge site to publish you'll be glad to be alerted when the rendering process is finally over).
You'll notice that the browser is not showing you the rendered page; when you publish an entire site, Frontier doesn't tell the browser about it at all.
So it's up to you to tell the browser to look at your site. Perhaps the best way to do this is to start in the Finder [Windows Explorer]. That way, you can easily study the structure of the site as rendered to disk. From there, you can double-click any of the HTML files to get the browser to open it.
On Mac OS, if the wrong browser opens the file, change the value of user.html.prefs.textFileCreator to match the creator code for your Web browser.
A thing you should experiment with at this point is the way the structure of the whole site on disk mirrors the structure of the whole site in the table.To see this, try putting fourthPage in a table of its own. In myFirstSite, make a new subtable using New Sub-Table from the Table menu. Call it "someFolder" (without the quotes). Move fourthPage out of myFirstSite and into the someFolder table. Now again select something in the myFirstSite table and publish the whole site, and examine the structure of the resulting files on disk. There is now a subfolder called "someFolder", and fourthPage.html is inside it, just as in the site table.
Wait a minute, what's this? Ooops! The fourthPage.html in the main site folder is also still there!
Frontier creates files and folders to reflect the structure of your site table, but it does not get rid of any files and folders (except when they are overwritten by the creation process). It is up to you to clean out your site if the structure changes; Frontier won't do it for you.
There's another problem. We have rendered thirdPage, as thirdPage.html. Since the only purpose of thirdPage is to be an element embedded in secondPage, that's a mistake. We need to "hide" thirdPage somehow so that it remains available to be embedded in secondPage, but doesn't get included in the publishing.A common solution is this: move thirdPage out of the myFirstSite table, and into myFirstSite.#tools. When a site table is published, Frontier doesn't look in the #tools folder for Web page objects.
Now, go back into secondPage and change its reference to thirdPage (in the renderObject call) so that it correctly reaches thirdPage:
{renderObject(@adrSiteRootTable^.["#tools"].thirdPage)}Notice the tricky way in which you have to speak of the #tools table. That's because it begins with a "#". Even though, in this tutorial, I often speak of myFirstSite.#tools and other such animals, you can't speak that way in a line of UserTalk. This example shows you the required syntax for such references.
Throw away everything in your site folder on disk, so we start with a clean slate. Publish the whole site table again.
Let's take stock. All Web page objects in the site table have been rendered. Where there is a subtable, it is mirrored as a folder on disk, and any Web page objects inside it are rendered. Things in the #tools table are not rendered.
An images folder has been created. But (although you might not be aware of this) not everything in the #images table is rendered to disk. The #images table is actually ignored; it's only the presence of an actual imageRef macro call in a rendered page that causes a particular image to be rendered. So you end up with only the image files you actually need on disk.
All text is by Matt Neuburg, phd, matt@tidbits.com.
For information about the book Frontier: The Definitive Guide, see my home page:
http://www.tidbits.com/matt
All text copyright Matt Neuburg, 1997 and 1998. ALL RIGHTS RESERVED.
No one else has any right to copy or reproduce in
any form, including electronic. You may download this material but you may not post it for others to
see or distribute it to others without explicit permission from the author.
Downloadable versions at http://www.ojai.net/matt/downloads/webTutorial.hqx and http://www.ojai.net/matt/downloads/webTutorial.zip.
Please do not confuse this tutorial with a certain other Frontier 5 tutorial based upon my earlier work.
This page created with
Frontier, 2/11/2000; 7:00:02 PM.