Custom Web Publishing - File Maker

Custom Web Publishing allows you to control the entire look, feel, and functionality of the Web site by custom hand-coding the format files and putting them in FileMaker’s Web folder. Format files are simply HTML files that combine HTML code as well as CDML tags that send instructions to and receive data from the copy of FileMaker Pro/Unlimited sharing the databases with the Web Companion plug-in. Once you’ve got these tools, fire up CDML Reference.fp5, which looks like this:

Custom Web Publishing

This reference not only contains complete explanations of all the CDML tags that you can use but also a lot of general information on creating format files, configuring the Web Companion plug-in, using the CDML tool, and even planning a database driven Web site. If you click the little wrench icon at the upper right of any CDML Reference.fp5 layout, the CDML Tool.fp5 database will launch. It looks like this:

Custom Web Publishing

With this tool you can quickly generate the HTML code you’ll need to create format files and to create CDML tags, which you can then copy and paste into the format files you’re creating in your Web page design tool (Microsoft Front Page, BBEdit, and so on). The great thing is that the CDML Tool pulls information (database and fields names, value list names, and so on) from your open FileMaker databases.

Salinger Citation Database Example
Now you’ll jump right in and take a look at some actual format files and CDML code. Open the “Salinger Citation Database” folder. Launch the SalingerCites.fp5 database, using the master password of -salinger-. Then look in the Web Site folder. Copy all these format files to your FileMaker Pro Web folder. Next, set the default home page in Web Companion’s configuration to index.htm. Go to your browser and reload “localhost”. You should see a custom-built format file that looks like this:

Salinger Citation Database Example

This is a pet project of the author’s, one that he hopes will someday provide an online database to Salinger fans who want to find books, articles, or other information by or about the American author J. D. Salinger. Click the search link (do a search for the author name of “Salinger” and view the results page) and otherwise generally explore the limited functionality available, which includes the ability to search the database and view the resulting “hit list” of citation records in list and form views.

When your done, open one of the format files that you’ve just copied into FileMaker’s Web folder like results.htm because it for sure contains some CDML tags using a text editor like Mac OS’s SimpleText or Windows’ Notepad. Some of the code looks like this:

Here’s more code from later in the format file:

The above code is useful as an example because it contains some of the different types of CDML tags that are available to you. The three basic types of tags are:

Action tags: Perform a specific task in FileMaker Pro. For example, the new tag creates a new record in your FileMaker Pro database.

Variable tags: Specify an option for the Action tags. For example, the db tag specifies the database that Web users will interact with.

Replacement tags: Act as placeholders and are swapped with data from a FileMaker Pro database. For example, the [FMP-field] tag is replaced with data from a FileMaker Pro field. In the code above, most of the tags you see are replacement tags.

So what does FileMaker Pro/Unlimited do when it encounters an CDML in a Web page that a Web browsing user requests? Well, it takes the code, scans through it, and processes the tags in the order that it receives them. Then, it creates a completed HTML document out of the combination of the static HTML code of the format file and the data retrieved from the referenced FileMaker databases. For example, if you read the above code carefully, you’ll see that the initial replacement tags such as [FMP- CURRENT FOUND COUNT] and [FMP- RANGEEND] are just values sent from FileMaker that indicate the number of records in the found set (the results.htm file is called as the result of a user’s search request, remember). Later in the above code you’ll see the following:

These tags are simple FileMaker If statements that figure out how to display the RedHat.gif graphic depending on the average user rating that the current work has. “.gte.” is CDML-speak for “greater than or equal to.” The [FMP-RECORD] and [/FMP-RECORD] tags tell FileMaker where the boundaries of each record in the found set are (a results.htm format file like this returns each found record as its own line in the final, formatted HTML file that’s ultimately returned to the user’s browser).

Planning a Custom Database-Driven Web Site
Before you start building your own custom data-driven Web site, you should sit down with Microsoft Visio, MacFlow , OmniGraffle, or a piece of paper and write down what you want the site to do, how the pages should be organized, and what all the links should do. When building custom format files for a FileMaker-driven Web site, you’ll need a minimum of a certain set of types of format files for the different functions you want to do. Here’s a list of the basic format files from the Salinger Web site example and what each does:

detail.htm: The detail view of a particular Salinger-related book/article record.
index.htm: The main welcome page. Contains no CDML tags. It ties together the content of the welcome.htm and topmenu.htm files into different browser frames.
news.htm: The page intended to contain a list of news stories related to J. D. Salinger.
results.htm: The list view–type format file that returns a list of records returned as a result of a user’s search.
search.htm: The page where users enter search criteria for records they want to find.
topmenu.htm: The menu at the top of every page on the site.
welcome.htm: The “meat” of the index.htm file.
Other format files that FileMaker-driven Web sites typically use include:
error.htm: A file that gives you an error message if something is wrong . . . like the database isn’t open or a user’s find request returns nothing.
delete.htm: A file that allows a user to delete a record in the database.
new.htm: A file that allows someone to add a record to the database.
newreply.htm: A file that gives a success/fail message to the user after they try to add a record.
deletereply.htm: A file that gives a success/fail message to the user after they try to delete a record.
Too, you might use edit.htm and editreply.htm format files when you want separate screens for editing existing records.

Also keep in mind that you generally need one complete set of all of the above format files for each and every FileMaker database that users will be interacting with. For instance, you would need a separate set of these pages to allow your remote sales force to edit/ browse/update contacts one for companies, one for orders, and so on.

You can see that there will be scores of format files in even the simplest of FileMaker driven Web sites. Thus it’s only elementary to carefully plan your site before you start coding it.

Calling Scripts
You can call a script in a FileMaker database via a custom Web page using a hidden tag in your form, as in the bolded fourth line of this example CDMLtagged HTML code:

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

File Maker Topics