fms18 CWP Guide
fms18 CWP Guide
®
Custom Web Publishing Guide
© 2004–2019 FileMaker, Inc. All Rights Reserved.
FileMaker, Inc.
5201 Patrick Henry Drive
Santa Clara, California 95054
FileMaker, FileMaker Cloud, FileMaker Go and the file folder logo are trademarks of FileMaker, Inc. registered in the U.S. and other
countries. FileMaker WebDirect is a trademark of FileMaker, Inc. All other trademarks are the property of their respective owners.
FileMaker documentation is copyrighted. You are not authorized to make additional copies or distribute this documentation without written
permission from FileMaker. You may use this documentation solely with a valid licensed copy of FileMaker software.
All persons, companies, email addresses, and URLs listed in the examples are purely fictitious and any resemblance to existing persons,
companies, email addresses, or URLs is purely coincidental. Product credits are listed in the Acknowledgments documents provided with
this software. Documentation credits are listed in the Documentation Acknowledgments. Mention of third-party products and URLs is for
informational purposes only and constitutes neither an endorsement nor a recommendation. FileMaker, Inc. assumes no responsibility
with regard to the performance of these products.
For more information, visit our website at www.filemaker.com.
Edition: 01
Contents
Preface 8
About this guide 8
Where to find FileMaker documentation 8
Chapter 1
Introducing Custom Web Publishing 9
About the Web Publishing Engine 10
How a Web Publishing Engine request is processed 10
Custom Web Publishing with XML 11
Custom Web Publishing with PHP 11
Comparing XML to PHP 11
Reasons to choose XML 11
Reasons to choose PHP 12
Chapter 2
Preparing databases for Custom Web Publishing 13
Enabling Custom Web Publishing in a database 13
Accessing a protected database 13
Protecting your published databases 14
Web server support for Internet media types (MIME) 15
About publishing the contents of container fields on the web 15
Container field objects embedded in a database 15
Container fields with stored file references 16
Container fields with externally stored data 16
Container fields and progressive download 17
How web users view container field data 17
FileMaker scripts and Custom Web Publishing 17
Script tips and considerations 18
Script behavior in Custom Web Publishing solutions 19
Script triggers and Custom Web Publishing solutions 19
Chapter 3
About Custom Web Publishing with XML 20
Creating dynamic websites with the Web Publishing Engine 20
Key features in Custom Web Publishing with XML 21
Web publishing requirements 21
What is required to publish a database using Custom Web Publishing 21
What web users need to access a Custom Web Publishing solution 21
Connecting to the Internet or an intranet 22
Where to go from here 22
Contents 4
Chapter 4
Accessing XML data with the Web Publishing Engine 23
Using Custom Web Publishing with XML 23
Comparing the Web Publishing Engine with XML import and export 23
How the Web Publishing Engine generates XML data from a request 24
General process for accessing XML data from the Web Publishing Engine 25
About the URL syntax for XML data and container objects 25
About the URL syntax for XML data 25
About the URL syntax for FileMaker container objects in XML solutions 26
About URL text encoding 27
Accessing XML data via the Web Publishing Engine 28
About namespaces for FileMaker XML 28
About FileMaker database error codes 29
Retrieving the document type definitions for the FileMaker grammars 29
Using the fmresultset grammar 29
Description of elements in the fmresultset grammar 30
XML data in the fmresultset grammar 32
Using other FileMaker XML grammars 33
Description of elements in the FMPXMLRESULT grammar 33
XML data in the FMPXMLRESULT grammar 34
Description of elements in the FMPXMLLAYOUT grammar 35
XML data in the FMPXMLLAYOUT grammar 37
About UTF-8 encoded data 38
Using FileMaker query strings to request XML data 38
Switching layouts for an XML response 40
Understanding how an XML request is processed 41
Troubleshooting XML document access 41
Chapter 5
Valid names used in XML query strings 42
About the query commands and parameters 42
Guidelines for using query commands and parameters 43
Query command parsing 44
About the syntax for a fully qualified field name 45
Using query commands with portal fields 45
About the syntax for specifying a global field 47
Query command reference 47
–dbnames (Database names) query command 47
–delete (Delete record) query command 47
–dup (Duplicate record) query command 48
–edit (Edit record) query command 48
–find, –findall, or –findany (Find records) query commands 49
–findquery (Compound find) query command 49
–layoutnames (Layout names) query command 50
–new (New record) query command 50
–scriptnames (Script names) query command 51
–view (View layout information) query command 51
Contents 5
Chapter 6
About Custom Web Publishing with PHP 64
Key features in Custom Web Publishing with PHP 64
Custom Web Publishing requirements 64
What is required to publish a database using Custom Web Publishing 64
What web users need to access a Custom Web Publishing solution 65
Connecting to the Internet or an intranet 65
Manually installing the FileMaker API for PHP 66
Where to go from here 67
Chapter 7
Overview of Custom Web Publishing with PHP 68
How the Web Publishing Engine works with PHP solutions 68
General steps for Custom Web Publishing with PHP 68
Chapter 8
Using the FileMaker API for PHP 71
Where to get additional information 71
FileMaker API for PHP Reference 71
FileMaker API for PHP support 71
Contents 6
Chapter 9
Staging, testing, and monitoring a site 92
Staging a Custom Web Publishing site 92
Contents 7
Appendix A
Error codes for Custom Web Publishing 98
Error code numbers in XML format 98
Error code numbers for FileMaker databases 99
Index 100
Preface
About this guide
This guide assumes you are experienced with using FileMaker® Pro Advanced to create
databases. You should understand the basics of FileMaker Pro Advanced database design and
the concepts of fields, relationships, layouts, portals, and containers. For information about
FileMaker Pro Advanced, see FileMaker Pro Advanced Help.
This guide also assumes you are experienced with developing websites, especially with using
technologies like XML or PHP to integrate FileMaker data with websites and web applications.
This guide provides the following information about Custom Web Publishing with
FileMaker Server:
1 what is required to develop a Custom Web Publishing solution
1 how to publish your databases using XML
1 how to obtain XML data from databases hosted by FileMaker Server
1 how to publish your databases using PHP
1 how to use the FileMaker API for PHP to obtain data from databases hosted by
FileMaker Server
1 what web users need to access a Custom Web Publishing solution
Products.fmp12 Customers.fmp12
1 2 3
Web Server Web Publishing Engine
Web Web Server Module
Browser Database
Server
FM API and PHP code Web Publishing Core
6 5 4
Using the FileMaker Server Web Publishing Engine for Custom Web Publishing
4. The FileMaker Server sends the requested FileMaker data to the Web Publishing Engine.
5. The Web Publishing Engine converts the FileMaker data to respond to the request.
1 For PHP requests, the FileMaker API for PHP converts the PHP request into an XML
request. The Web Publishing Engine processes the XML request and sends XML data back
to the FileMaker API for PHP. The FileMaker API for PHP then converts the XML data into
PHP objects that can be used by the PHP application.
1 For XML requests, the Web Publishing Engine sends XML data directly to the web server.
6. The web server sends the output to the requesting web browser or program.
Important Security is important when you publish data on the web. Review the security
guidelines in FileMaker Security Guide.
Chapter 1 | Introducing Custom Web Publishing 11
For information about getting a database ready for Custom Web Publishing, see chapter 2,
“Preparing databases for Custom Web Publishing.”
Note For information about Custom Web Publishing with XML, see chapter 3, “About Custom
Web Publishing with XML.”
Chapter 1 | Introducing Custom Web Publishing 12
Note For information about Custom Web Publishing with PHP, see chapter 6, “About Custom
Web Publishing with PHP.”
Chapter 2
Preparing databases for Custom Web
Publishing
Before you can use Custom Web Publishing with a database, you must prepare the database and
protect it from unauthorized access.
1. In FileMaker Pro Advanced, open the database you want to publish using an account that has
the Full Access privilege set. Alternatively, you can open the database using an account that
has the Manage Extended Privileges access privileges.
2. Assign the Custom Web Publishing extended privilege that you want to use:
1 For Custom Web Publishing with XML, use fmxml
1 For Custom Web Publishing with PHP, use fmphp
3. Assign a privilege set that includes the Custom Web Publishing extended privilege to one or
more accounts, or to the Admin or Guest account.
Note When defining account names and passwords for Custom Web Publishing solutions, use
printable ASCII characters, for example a-z, A-Z, and 0-9. For more secure account names and
passwords, include punctuation characters such as “!” and “%,” but do not include colons. For
information on setting up accounts, see FileMaker Pro Advanced Help.
The following list summarizes the process that occurs when a web user uses a Custom Web
Publishing solution to access a database:
1 If you have not assigned a password for an account, web users only specify the account name.
1 If the Guest account is disabled, then users will be prompted for account name and password
when they access the database. The account must have a Custom Web Publishing extended
privilege enabled.
1 If the Guest account is enabled and has a privilege set enabled that includes a Custom Web
Publishing extended privilege, all web users automatically open the database with the access
privileges assigned to the Guest account. If the Custom Web Publishing extended privilege is
assigned to the Guest account:
1 Web users are not prompted for an account name and password when opening a file.
1 All web users will automatically sign in with the Guest account and assume the Guest
account privileges. You can let users change their sign-in accounts from a web browser with
the Re-Login script step (for example, to switch from the Guest account to an account with
more privileges).
1 The default privilege set for Guest accounts provides “read-only” access. You can change
the default privileges, including extended privileges, for this account. See FileMaker Pro
Advanced Help.
1 When a web user has entered valid account information, that account information is reused as
long as the browser session has not timed out. When the browser session times out, then the
web user is again prompted to enter a valid account.
Note By default, web users cannot modify their account password from a web browser. You can
build this feature into a database with the Change Password script step, which allows web users
to change their passwords from their browser. See FileMaker Pro Advanced Help.
FileMaker Server supports encryption for data written to disk and for data transmitted to clients.
1 Encrypt your database by using the Database Encryption feature of FileMaker Pro Advanced.
Encryption protects the FileMaker database file and any temporary files written to disk. See
FileMaker Server Installation and Configuration Guide and FileMaker Pro Advanced Help.
1 An encrypted database that is hosted on FileMaker Server is opened by using Admin
Console or the CLI. As the FileMaker Server administrator, you open the file with its
database encryption password, so that FileMaker clients can use the encrypted database.
1 Once the FileMaker encrypted database is opened with the encryption password by the
FileMaker Server administrator, FileMaker clients don’t need the encryption password to
access the encrypted database. For information about opening an encrypted database, see
FileMaker Server Help.
1 Use Secure Sockets Layer (SSL) encryption for communication between the web server and
web browsers. SSL connections are accessed through an HTTPS connection.
FileMaker Server provides a standard SSL certificate signed by FileMaker, Inc. that does not
verify the server name. The FileMaker default certificate is intended only for test purposes. A
custom SSL certificate is required for production use. See FileMaker Server Installation and
Configuration Guide.
When you import a custom SSL certificate, Database Server client connections use SSL; HTTP
connections are routed to HTTPS. With a custom SSL certificate, use the HTTPS directory for
hosting PHP site files. See chapter 7, “General steps for Custom Web Publishing with PHP.”
For information on securing your database, see FileMaker Security Guide.
Note For security reasons, webpages hosted by other web servers may not use the <iframe> tag
to embed Custom Web Publishing content. If you want to embed Custom Web Publishing content
in the <iframe> tags of separate webpages, those webpages must be hosted by the
FileMaker Server web server.
1. Store the container object files in the Web folder inside the FileMaker Pro Advanced folder.
2. In FileMaker Pro Advanced, insert the objects into the container field and select the Store only
a reference to the file option.
3. Copy or move the referenced object files in the Web folder to the same relative path location in
the root folder of the web server software.
1 For IIS (Windows):
[drive]:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf
where [drive] is the drive on which the Web Publishing Engine component of your
FileMaker Server deployment resides.
1 For Apache (macOS): /Library/FileMaker Server/HTTPServer/htdocs
Note For container objects stored as file references, your web server must be configured to
support the MIME types for the kinds of files you want to serve, such as movies. Your web server
determines the support for the current MIME types registered for the Internet. The Web Publishing
Engine does not change a web server’s support for MIME. See the documentation for your web
server.
1. Place the database file in the proper location on the server. Place the FileMaker Pro Advanced
database files that you want FileMaker Server to open—or shortcuts (Windows) or aliases
(macOS) to those files—in the following folders:
1 Windows:
[drive]:\Program Files\FileMaker\FileMaker Server\Data\Databases\
where [drive] is the primary drive from which the system is started.
1 macOS: /Library/FileMaker Server/Data/Databases/
Or you can place the files in an optionally specified additional database folder.
2. In the folder where you placed the database, create a folder named RC_Data_FMS, if it
doesn’t already exist.
Chapter 2 | Preparing databases for Custom Web Publishing 17
3. In the RC_Data_FMS folder, create a folder with a name that matches the name of your
database. For example, if your database is named Customers, then create a folder named
Customers. Place the externally stored objects in the new folder you created.
Note When databases are hosted on FileMaker Server, there is no way for multiple databases
to share a common folder of container objects. The container objects for each database needs
to be in a folder identified by that database’s name.
4. For files that will be shared from macOS, change the files to belong to the fmsadmin group.
For information about manually uploading databases, see FileMaker Server Help.
FileMaker supports many script steps in Custom Web Publishing. Web users can perform a variety
of automated tasks when you use scripts in a query string for a URL. To see script steps that
Custom Web Publishing supports, in the FileMaker Pro Advanced Script Workspace window, click
the Compatibility button and choose Custom Web Publishing. Script steps that are not dimmed
are supported for Custom Web Publishing. For information on creating scripts, see FileMaker Pro
Advanced Help.
1 Any script that modifies data should include the Commit Record/Request script step, because
data changes aren’t visible in the browser until the data is saved or “submitted” to the server.
This includes several script steps like Cut, Copy, and Paste. Many single-step actions should
be converted into scripts to include the Commit Record/Request step. When designing scripts
that will be executed from a web browser, include the Commit Record/Request step at the end
of a script to make sure all changes are saved.
1 Scripts dependent on data that has been changed but not yet committed may not work as they
do with a FileMaker Pro Advanced client. For example, if a field contains a Get(ModifiedFields)
calculation, when the record is edited through an XML query or a PHP call, the
Get(ModifiedFields) calculation returns an empty list. However, if the Custom Web Publishing
solution runs a FileMaker script that edits the record, the Get(ModifiedFields) calculation
returns a list of fields that were edited by the script.
1 To create conditional scripts based on the type of client, use the Get(ApplicationVersion)
function. If the value returned includes a “Web Publishing Engine” string, then you know that
the current user is accessing your database with Custom Web Publishing. For information on
functions, see FileMaker Pro Advanced Help.
1 Open each script that web users might run, and verify that the script will execute properly when
the database is hosted as a Custom Web Publishing solution. Check that the script uses only
script steps that are supported for Custom Web Publishing, as described above.
Note In Custom Web Publishing solutions, the OnFirstWindowOpen script trigger is not
activated. The OnLastWindowClose script trigger is activated only when a script closes the last
virtual window. You can run scripts manually using the XML –script query parameter or the PHP
newPerformScriptCommand() method.
Chapter 3
About Custom Web Publishing with XML
Creating dynamic websites with the Web Publishing Engine
The Web Publishing Engine provides Custom Web Publishing for FileMaker Server using XML
data publishing. Custom Web Publishing provides several benefits:
1 Customization: You can determine how web users interact with FileMaker data, and how the
data displays in web browsers.
1 Data interchange: By using FileMaker XML, you can exchange FileMaker data with other
websites and applications.
1 Data integration: You can integrate FileMaker data into other websites, with other middleware,
and with custom applications. You can make the data look like it belongs to another website
instead of displaying an entire FileMaker layout in the web browser.
1 Security: The FileMaker Server administrator can enable or disable XML web publishing for all
databases hosted by the server. As the FileMaker database owner, you can control web user
access to XML web publishing for each database.
1 Control and filtering of published data: You can control and filter the data and the type of
database information you want to publish, which prevents unauthorized use of the database.
You can also hide metadata, such as database and field names.
1 Based on an open standard: You have more access to tools, resources and skilled personnel
for Custom Web Publishing solutions. If you know standard XML, then you can start developing
solutions after learning a few unique details about Custom Web Publishing with XML, such as
the URL syntax and query parameters to use.
Custom Web Publishing with XML allows you to retrieve data from FileMaker databases, and
easily use the data in other output formats. By using an HTTP request with the appropriate query
commands and parameters, you can retrieve FileMaker data as an XML document. You can then
use the XML data in other applications. See “Accessing XML data via the Web Publishing Engine”
on page 28.
Chapter 3 | About Custom Web Publishing with XML 21
Note The Web Publishing Engine generates XML data that is well-formed and compliant with the
XML 1.0 specification. For details about the requirements for well-formed XML, see the XML
specification at www.w3.org.
Comparing the Web Publishing Engine with XML import and export
The Web Publishing Engine and FileMaker Pro Advanced both enable you to use XML data with
FileMaker databases. There are, however, some important differences between the two methods:
1 For accessing XML data, the Web Publishing Engine supports the fmresultset,
FMPXMLRESULT, and FMPXMLLAYOUT grammars. For XML import, FileMaker Pro Advanced
uses the FMPXMLRESULT grammar, and for export, FileMaker Pro Advanced uses the
FMPXMLRESULT grammar. See “Accessing XML data via the Web Publishing Engine” on
page 28.
1 To access XML data with the Web Publishing Engine, you use a Web Publishing Engine query
string in a URL. To import and export XML with FileMaker Pro Advanced, you use
FileMaker Pro Advanced menu commands or scripts.
1 The Web Publishing Engine is server-based and can be installed on the same or a different host
than FileMaker Server. FileMaker Pro Advanced XML import and export is desktop-based.
1 You can dynamically access XML data from FileMaker databases by using URL requests with
the Web Publishing Engine. The FileMaker Pro Advanced XML export feature generates a pre-
specified XML data file.
1 Working with XML data via the Web Publishing Engine is an interactive operation.
FileMaker Pro Advanced XML import and export is a batch operation.
1 The Web Publishing Engine can access XML data from a FileMaker portal, but FileMaker Pro
Advanced cannot.
Chapter 4 | Accessing XML data with the Web Publishing Engine 24
1 The Web Publishing Engine can access data in a container field, but FileMaker Pro Advanced
cannot.
1 The Web Publishing Engine provides real-time access to FileMaker data via HTTP or HTTPS,
but FileMaker Pro Advanced cannot.
Note For information on using FileMaker Pro Advanced to import and export data in XML format,
see FileMaker Pro Advanced Help.
How the Web Publishing Engine generates XML data from a request
After a request for XML data is sent to the web server, the Web Publishing Engine queries the
FileMaker database and returns the data as an XML document.
3. Web Publishing
Web Core requests data
Browser FileMaker Server Web from database hosted
Publishing Engine by FileMaker
Database Server.
1. HTTP or FileMaker Database
HTTPS request Web Publishing Core Server
for XML data is Web Server
sent from web
browser or 2. Web server
program to web routes request
Web Server Module to Web
server. Custom Web Publishing
Publishing
Core. Engine (CWPE)
Products.fmp12 Customers.fmp12
Request for XML data is routed from web browser or program to FileMaker Database Server
Orders.fmp12 Catalog.fmp12
XML data is routed back from FileMaker Database Server to web browser or program
Web
Browser FileMaker Server Web 4. FileMaker Database
5. Web Publishing Core Publishing Engine Server sends requested
converts data to XML and data to Web Publishing
sends it to web server. Core.
6. Web server Web Publishing Core
sends output to
web browser or Web Server
program.
General process for accessing XML data from the Web Publishing Engine
Here is an overview of the process for using the Web Publishing Engine to access XML data in a
FileMaker database:
1. Using the CLI, make sure XML Publishing is enabled. See FileMaker Server Help.
2. In FileMaker Pro Advanced, open each FileMaker database that you’re publishing and make
sure the database has the fmxml extended privilege enabled for XML Custom Web Publishing.
See “Enabling Custom Web Publishing in a database” on page 13.
To access XML data in a portal, set the view for the database layout to View as Form or View
as List. If a user or script changes the view of the database layout to View as Table, only the
first related record (first row of the portal) is accessible as XML data.
The XML data is output in an order that corresponds to the order in which field objects were
added to the layout. If you want the XML data order to match the order in which fields appear
on the screen (top-to-bottom, left-to-right), then select all fields, group them, and then ungroup
them. This procedure resets the layout order to match the screen order.
3. In FileMaker Server Admin Console, confirm that each FileMaker database you’re publishing
has the fmxml extended privilege enabled.
1 In Admin Console, click the Databases page.
1 Select Show Extended Privileges from the menu selector next to All Databases. The text
FMXML is displayed for databases that have the fmxml extended privilege enabled.
4. Send an HTTP or HTTPS request in the form of a URL that specifies the FileMaker XML
grammar, one query command, and one or more FileMaker query parameters to the Web
Publishing Engine through an HTML form, an HREF link, or a script in your program or
webpage. You can also type the URL in a web browser.
For information on specifying the URL, see the next section, “About the URL syntax for XML
data and container objects.” For information on query commands and parameters, see “Using
FileMaker query strings to request XML data” on page 38, and chapter 5, “Valid names used in
XML query strings.”
5. The Web Publishing Engine uses the grammar you specified in the URL to generate XML data
containing the results of your request, such as a set of records from the database, and returns
it to your program or web browser.
6. The web browser, if it has an XML parser, displays the data, or the program uses the data in
the way you specified.
About the URL syntax for XML data and container objects
This section describes the URL syntax for using the Web Publishing Engine to access XML data
and container objects from FileMaker databases.
where:
1 <scheme> can be the HTTP or HTTPS protocol.
1 <host> is the IP address or domain name of the host where the web server is installed.
1 <port> is optional and specifies the port that the web server is using. If no port is specified,
then the default port for the protocol is used (port 80 for HTTP, or port 443 for HTTPS).
1 <xml_grammar> is the name of the FileMaker XML grammar. Possible values are
fmresultset, FMPXMLRESULT, or FMPXMLLAYOUT. See “Using the fmresultset grammar” on
page 29 and “Using other FileMaker XML grammars” on page 33.
1 <query string> is a combination of one query command and one or more query parameters
for FileMaker XML publishing. (The –dbnames command doesn’t require any parameters.) See
“Using FileMaker query strings to request XML data” on page 38, and chapter 5, “Valid names
used in XML query strings.”
Note The URL syntax, including the names of the query command and parameters, is case
sensitive except for portions of the query string. The majority of the URL is in lowercase, with the
exception of the two uppercase grammar names: FMPXMLRESULT and FMPXMLLAYOUT. For
information on the rules for case sensitivity of the query string, see “Guidelines for using query
commands and parameters” on page 43.
Examples
http://server.company.com/fmi/xml/fmresultset.xml?-db=products&-lay=sales
&-findall
http://192.168.123.101/fmi/xml/FMPXMLRESULT.xml?-db=products&-lay=sales
&-findall
About the URL syntax for FileMaker container objects in XML solutions
In a generated XML document for an XML solution, the syntax used to refer to a container object
is different for container fields that store the actual object in the database, as opposed to container
fields that store a reference to the object.
Example
<data>/fmi/xml/cnt/data.jpg?-db=products&-lay=sales
&-field=product_image(1)&-recid=2</data>
Chapter 4 | Accessing XML data with the Web Publishing Engine 27
Note In the generated XML for a container field, the value for the –field query parameter is a
fully qualified field name. The number in the parentheses indicates the repetition number for the
container field, and is generated for both repeating and non-repeating fields. See “About the
syntax for a fully qualified field name” on page 45.
To retrieve the container data from the database, use the following syntax:
<scheme>://<host>[:<port>]/fmi/xml/cnt/data.<extension>?<query string>
For information about <scheme>, <host>, or <port>, see the previous section, “About the URL
syntax for XML data.”
Example
http://www.company.com/fmi/xml/cnt/data.jpg?-db=products&-lay=sales
&-field=product_image(1)&-recid=2
Example
<data>/images/logo.jpg</data>
Note The referenced container object must be stored in the FileMaker Pro Advanced Web folder
when the record is created or edited, and then copied or moved to a folder with the same relative
location in the root folder of the web server software. See “About publishing the contents of
container fields on the web” on page 15.
Example
To set the value of the “info” field to fiancée, you could use the following URL:
http://server.company.com/fmi/xml/fmresultset.xml?-db=members
&-lay=relationships&-recid=2&info=fianc%C3%A9e&-edit
%C3%A9 is the URL encoded UTF-8 representation of the é character.
Note XML data generated by the Web Publishing Engine is encoded using UTF-8 format
(Unicode Transformation Format 8). See “About UTF-8 encoded data” on page 38.
FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"
FMPXMLLAYOUT xmlns="http://www.filemaker.com/fmpxmllayout"
Chapter 4 | Accessing XML data with the Web Publishing Engine 29
FMPXMLRESULT <ERRORCODE>0</ERRORCODE>
FMPXMLLAYOUT <ERRORCODE>0</ERRORCODE>
The error code element in the XML document indicates errors related to the database and query
strings. See appendix A, “Error codes for Custom Web Publishing.”
FMPXMLRESULT http://<host>[:<port]/fmi/xml/FMPXMLRESULT.dtd
FMPXMLLAYOUT http://<host>[:<port]/fmi/xml/FMPXMLLAYOUT.dtd
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&-findall
The Web Publishing Engine will generate an XML document using the fmresultset grammar.
In the XML document, the Web Publishing Engine will reference the document type definition for
the fmresultset grammar in the <!DOCTYPE> instruction in the second line of the document,
immediately after the <?xml...?> instruction. The <!DOCTYPE> instruction specifies the URL for
downloading the DTD for the fmresultset grammar.
Chapter 4 | Accessing XML data with the Web Publishing Engine 30
<datasource> element
In the fmresultset grammar, the <datasource> element contains the table, layout, date-
format, time-format, timestamp-format, total-count, and database attributes.
1 The date-format attribute of the <datasource> element specifies the format of dates in the
XML document:
MM/dd/yyyy
where:
1 MM is the 2-digit value for the month (01 through 12, where 01 is January and 12 is
December)
1 dd is the 2-digit value for the day of the month (01 through 31)
1 yyyy is the 4-digit value for the year
1 The time-format attribute of the <datasource> element specifies the format of times in the
XML document:
HH:mm:ss
where:
1 HH is the 2-digit value for hours (00 through 23, for the 24-hour format)
1 mm is the 2-digit value for minutes (00 through 59)
1 ss is the 2-digit value for seconds (00 through 59)
1 The timestamp-format attribute of the <datasource> element combines the formats of date-
format and time-format into one timestamp:
MM/dd/yyyy HH:mm:ss
Chapter 4 | Accessing XML data with the Web Publishing Engine 31
<metadata> element
The <metadata> element of the fmresultset grammar contains one or more <field-
definition> and <relatedset-definition> elements, each containing attributes for one
of the fields of the result set.
The <field-definition> attributes specify:
1 whether the field is an auto-enter field ("yes" or "no")
1 whether the field is a four-digit-year field ("yes" or "no")
1 whether it is a global field ("yes" or "no")
1 the maximum number of repeating values (max-repeat attribute)
1 the maximum number of characters allowed (max-characters attribute)
1 whether it is a not-empty field ("yes" or "no")
1 whether it is for numeric data only ("yes" or "no")
1 result ("text", "number", "date", "time", "timestamp", or "container")
1 whether it is a time-of-day field ("yes" or "no")
1 type ("normal", "calculation", or "summary")
1 and the field name (fully qualified as necessary)
The <relatedset-definition> element represents a portal. Each related field in a portal is
represented by the <field-definition> element contained within the
<relatedset-definition> element. If there are multiple related fields in a portal, the field
definitions for the related fields are grouped within a single <relatedset-definition>
element.
<resultset> element
The <resultset> element contains the <record> elements returned as the result of a query
and an attribute for the total number of records found. Each <record> element contains the field
data for one record in the result set—including the mod-id and the record-id attributes for the
record, and the <data> element containing the data for one field in the record.
Each record in a portal is represented by a <record> element within the <relatedset>
element. The count attribute of the <relatedset> element specifies the number of records in
the portal, and the table attribute specifies the table associated with the portal.
Chapter 4 | Accessing XML data with the Web Publishing Engine 32
Example
http://192.168.123.101/fmi/xml/FMPXMLRESULT.xml?-db=employees&-lay=family
&-findall
To use the FMPXMLLAYOUT grammar, specify the following grammar name with the –view query
command in the URL requesting the XML document from the Web Publishing Engine:
FMPXMLLAYOUT.xml
Example
http://192.168.123.101/fmi/xml/FMPXMLLAYOUT.xml?-db=employees&-lay=family
&-view
Note When specifying the FMPXMLRESULT and FMPXMLLAYOUT grammars, be sure to enter the
grammar name in uppercase.
In the generated XML document, the Web Publishing Engine will reference the document type
definition for the grammar in the <!DOCTYPE> instruction in the second line of the document,
immediately after the <?xml...?> instruction. The <!DOCTYPE> instruction specifies the URL for
downloading the DTD for the grammar.
The <RESULTSET> element contains all of the <ROW> elements returned as the result of a query
and an attribute for the total number of records found. Each <ROW> element contains the
field/column data for one row in the result set. This data includes the RECORDID and MODID for
the row (see “–modid (Modification ID) query parameter” on page 56), and the <COL> element.
The <COL> element contains the data for one field/column in the row where multiple <DATA>
elements represent one of the values in a repeating or portal field.
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="03/29/2019" NAME="FileMaker Web Publishing Engine"
VERSION="18.0.1.0"/>
<DATABASE DATEFORMAT="MM/dd/yyyy" LAYOUT="web" NAME="art" RECORDS="12"
TIMEFORMAT="HH:mm:ss"/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Title" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Artist" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Image" TYPE="CONTAINER"/>
</METADATA>
<RESULTSET FOUND="1">
<ROW MODID="7" RECORDID="4">
<COL>
<DATA>Village Market</DATA>
</COL>
<COL>
<DATA>Camille Pissarro</DATA>
</COL>
<COL>
<DATA>/fmi/xml/cnt/Untitled.pct?-db=art&-lay=web&-recid=4
&-field=Image(1)
</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
The order of the <COL> elements corresponds with the order of the <FIELD> elements in the
<METADATA> element—for example, where the “Title” and “Artist” fields are listed in the
<METADATA> element, “Village Market” and then “Camille Pissarro” are listed in the same
order in the <RESULTSET> and <ROW> elements.
Chapter 4 | Accessing XML data with the Web Publishing Engine 35
Example
1 If Also display values from second field and Show values only from second field are both
selected, the DISPLAY attribute contains the value in the second field only.
Example
1 If Also display values from second field is selected and Show values only from second
field is not selected, the DISPLAY attribute contains the values in both fields of a value list.
Example
The DISPLAY attribute contains both the art style’s ID number and the art style’s name:
<VALUELISTS>
<VALUELIST NAME="style">
<VALUE DISPLAY="100 Impressionism">100</VALUE>
<VALUE DISPLAY="101 Cubism">101</VALUE>
<VALUE DISPLAY="102 Abstract">102</VALUE>
</VALUELIST>
</VALUELISTS>
For date, time, and timestamp fields, data for value lists are formatted using the “fm” format for
that field type. The “fm” formats are MM/DD/YYYY for date, hh:mm:ss for time, and MM/DD/YYYY
hh:mm:ss for timestamp. For example, if a “birthdays” value list is used for a pop-up menu on a
“birthdate” field of a layout, and the “birthdate” field is of type date, then the values output for that
value list will all be in the “fm” date format.
Note If two fields with different field types on a layout share the same value list, the first field’s
type determines the format of the value list data.
Chapter 4 | Accessing XML data with the Web Publishing Engine 37
<FMPXMLLAYOUT xmlns="http://www.filemaker.com/fmpxmllayout">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="03/29/2019" NAME="FileMaker Web Publishing Engine"
VERSION="18.0.1.0"/>
<LAYOUT DATABASE="art" NAME="web2">
<FIELD NAME="Title">
<STYLE TYPE="EDITTEXT" VALUELIST=""/>
</FIELD>
<FIELD NAME="Artist">
<STYLE TYPE="EDITTEXT" VALUELIST=""/>
</FIELD>
<FIELD NAME="Image">
<STYLE TYPE="EDITTEXT" VALUELIST=""/>
</FIELD>
<FIELD NAME="artlocations::Location">
<STYLE TYPE="EDITTEXT" VALUELIST=""/>
</FIELD>
<FIELD NAME="artlocations::Date">
<STYLE TYPE="EDITTEXT" VALUELIST=""/>
</FIELD>
<FIELD NAME="Style">
<STYLE TYPE="POPUPMENU" VALUELIST="style"/>
</FIELD>
</LAYOUT>
<VALUELISTS>
<VALUELIST NAME="style">
<VALUE DISPLAY="Impressionist">Impressionist</VALUE>
<VALUE DISPLAY="Modern">Modern</VALUE>
<VALUE DISPLAY="Abstract">Abstract</VALUE>
</VALUELIST>
</VALUELISTS>
</FMPXMLLAYOUT>
Chapter 4 | Accessing XML data with the Web Publishing Engine 38
Note Be sure to use a web browser or text editor program that supports UTF-8 files.
Example
You can use the –findall query command in the following query string in a URL to request
a list of all products in a FileMaker database named “products”:
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=products
&-lay=sales&-findall
A query string must contain only one query command, such as –new. Most query commands also
require various matching query parameters in the query string. For example, all query commands
except –dbnames require the –db parameter that specifies the database to query.
You can also use query commands and parameters in a URL.
Chapter 4 | Accessing XML data with the Web Publishing Engine 39
This section contains a summary of the FileMaker query commands and parameters. For
information about using them in a query string, see “Valid names used in XML query strings” on
page 42.
Use this query command name To execute this command
–dbnames Retrieve names of all hosted and web-shared databases.
–layoutnames Retrieve names of all available layouts for a hosted and web-shared database.
–scriptnames Retrieve names of all available scripts for a hosted and web-shared database.
–field Required to specify a field in a URL for container requests. See “About the URL syntax
for FileMaker container objects in XML solutions” on page 26.
fieldname At least one field name is required with –edit. Optional with –find. See “fieldname
(Non-container field name) query parameter” on page 52.
fieldname.op (operator) Optional with –find
–lay (layout name) Required with all query commands, except –dbnames, –layoutnames, and
–scriptnames
–lay.response (switch layout for XML Optional with all query commands, except –dbnames, –layoutnames, and
response) –scriptnames
–relatedsets.filter Optional with –find, –findall, –findany, –edit, –new, –dup, and –findquery
–script (perform script) Optional with –find, –findall, –findany, –new, –edit, –delete, –dup, –view,
and –findquery
Chapter 4 | Accessing XML data with the Web Publishing Engine 40
–script.prefind (perform script before Optional with –find, –findany, –findall, and –findquery
–find, –findany, and –findall)
–script.presort (perform script before Optional with –find, –findall, and –findquery
sort)
Example
The following request searches for values greater than 100,000 in the “Salary” field on the
“Budget” layout. The resulting data is displayed using the “ExecList” layout, which does not
include the “Salary” field.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=Budget&Salary=100000&Salary.op=gt&-find&-lay.response=ExecList
Chapter 4 | Accessing XML data with the Web Publishing Engine 41
2. Set the global field values specified in the query (the “.global=” portion of a URL).
8. Process the –lay.response query parameter to switch to a different layout, if this is specified.
Important The –lay parameter for specifying a layout is required with all query commands
except –dbnames, –layoutnames, and –scriptnames.
Chapter 5 | Valid names used in XML query strings 43
1. Does the query have a command and is the query command valid?
It is an error if the query is missing the command or uses an unknown command.
Example
-database
Example
-find&-edit
Example
-lop=amd
4. Is the query missing the required database name parameter (–db parameter)?
5. Is the query missing the required layout name parameter (–lay parameter)?
Note If a query contains valid but extraneous information, the query is processed without an
error. For example, if you specify the –lop parameter on a –delete command, the –lop
parameter is ignored because it does not cause the query to be invalid or ambiguous.
For information about specific error codes returned, see appendix A, “Error codes for Custom Web
Publishing.”
Chapter 5 | Valid names used in XML query strings 45
Note To be accessible, fields must be placed on the layout you specify in the query string.
Example
The following URL adds a new parent Employee record for John Doe, and a new related
record for Jane in the portal at the same time. The name of the related table is Dependents,
and the name of the related field in the portal is Names. The match field, ID, stores an
employee ID number.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&FirstName=John&LastName=Doe&ID=9756&Dependents::Names.0=Jane&-new
Note You can only add one related record to a portal per request.
Chapter 5 | Valid names used in XML query strings 46
Examples
The following URL edits a record in a portal where the parent record has the record ID of 1001.
Dependents is the name of the related table, Names is the name of the related field in the
portal, and the 2 in Names.2 is the record ID of a portal record.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&-recid=1001&Dependents::Names.2=Kevin&-edit
How to use one request to edit multiple portal records via the parent record:
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&-recid=1001&Dependents::Names.2=Kevin&Dependents::Names.5=Susan&-edit
You can also use the –edit command and specify 0 as the portal record ID to add a new
related record in the portal for an existing parent record.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&-recid=1001&Dependents::Names.0=Timothy&-edit
Examples
The following URL deletes record “1001” from the table “employees”:
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&-recid=1001&-delete
But the following URL deletes a portal record with a record ID of “3” from the related table
called “Dependents”, with the parent record ID of “1001”.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees&-lay=family
&-recid=1001&-delete.related=Dependents.3&-edit
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&Country.global=USA&-recid=1&-edit
Example
Example
To delete a record:
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-recid=4&-delete
Chapter 5 | Valid names used in XML query strings 48
Example
Note The –edit command can be used for editing records in a portal. See “Editing records in a
portal” on page 46.
Example
To edit a record:
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-recid=13&Country=USA&-edit
Chapter 5 | Valid names used in XML query strings 49
Examples
Notes
1 Specifying a field name multiple times in a single request is not supported; FileMaker Server
parses all of the values, but uses only the last value parsed.
1 When using the –findall command, avoid computer memory overload problems by
specifying a default maximum number of records to return per page by using the –max query
parameter.
Example
Find records for cats or dogs that are not named “Fluffy”:
http://host/fmi/xml/fmresultset.xml?-db=vetclinic&-lay=animals
&-query=(q1);(q2);!(q3)&-q1=typeofanimal&-q1.value=Cat&-q2=typeofanimal
&-q2.value=Dog&-q3=name&-q3.value=Fluffy&-findquery
Chapter 5 | Valid names used in XML query strings 50
Example
Note For information on including new data for a portal, see “Adding records to a portal” on
page 45.
Example
Example
Examples
Note When specifying the name of the database for the –db parameter in query strings, do not
include a filename extension. The actual database filename can optionally include an extension,
but extensions are not allowed as a value for the –db parameter.
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-findall
Chapter 5 | Valid names used in XML query strings 52
Example
The following deletes a portal record with a record ID of “20” from the related table called
“jobtable”, with a parent record ID of “7”.
http://host/fmi/xml/fmresultset.xml?-db=career&-lay=applications&-recid=7
&-delete.related=jobtable.20&-edit
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-op=eq&FirstName=Sam&-max=1&-find
Note Specifying a field name multiple times in a single request is not supported;
FileMaker Server parses all of the values, but uses only the last value parsed.
cn *word*
bw word*
ew *word
gt > word
lt < word
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&name=Tim&name.op=cn&-find
Note The bw keyword does not work with date, time, or timestamp strings, or with the current
date (//) find operator.
Chapter 5 | Valid names used in XML query strings 54
You can use any FileMaker Pro Advanced find operator by including it as part of the search criteria
instead of specifying the fieldname.op operator keyword. For example, to find a range of values
using the range (...) find operator, do not specify any operator keyword. Instead, use the
characters “...” between the range values in the search criteria.
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&IDnum=915...925&-find
For information on the operators you can use to find text, see FileMaker Pro Advanced Help.
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-view
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=Budget&Salary=100000&Salary.op=gt&-find&-lay.response=ExecList
Chapter 5 | Valid names used in XML query strings 55
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&Last+Name=Smith&Birthdate=2/5/1972&-lop=and&-find
Note The –max query parameter does not affect the values returned for portal records. To limit
the number of rows returned for portal records, see “–relatedsets.max (Limit portal records) query
parameter” on page 59.
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-max=10&-findall
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-max=all&-findall
Chapter 5 | Valid names used in XML query strings 56
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-recid=22&-modid=6&last_name=Jones&-edit
Note It is not recommended to use the same fields for multiple q variables in the same “and”
search criteria.
1 As with FileMaker Pro Advanced, each request can be either a find request or an omit request.
A find request adds the matching records to the found set; an omit request removes the
matching records from the found set. The default is a find request. For an omit request, put an
exclamation point (!) in front of the opening parenthesis.
Example
(q1);!(q2)
q1 is a find request; q2 is an omit request because it is preceded by an exclamation point.
Chapter 5 | Valid names used in XML query strings 57
1 Requests are separated by semicolons. Multiple find requests act as logical OR searches that
broaden the found set. For example, (q1);(q2) returns records that match q1 or q2. Omit
requests do not act as logical OR searches because omit requests remove records from the
found set.
1 Requests are executed in the order specified; the found set includes the results of the entire
compound find request.
<request-definitions> is a request definition for each request declaration. Each request
definition consists of a search field and value definition. A minus (-) sign starts the request
definition.
Syntax:
-<query-id>=<fieldname>&-<query-id>.value=<value>
Examples
-q1=typeofanimal&-q1.value=Cat
-q2=name&-q2.value=Fluffy
Find records of gray cats that are not named “Fluffy”:
http://host/fmi/xml/fmresultset.xml?-db=petclinic&-lay=Patients
&-query=(q1, q2);!(q3)&-q1=typeofanimal&-q1.value=Cat&-q2=color
&-q2.value=Gray&-q3=name&-q3.value=Fluffy&-findquery
Examples
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-recid=22&-delete
http://localhost/fmi/xml/FMPXMLLAYOUT.xml?-db=test&-lay=empty&-view
&-recid=9
Chapter 5 | Valid names used in XML query strings 58
Notes
1 The –relatedsets.filter parameter has no impact on how portal records are sorted in
XML queries. The sort specified in FileMaker Pro Advanced is respected whether the
–relatedsets.filter parameter value is layout or none.
1 The Filter portal records setting in the Portal Setup dialog box is not supported for XML
queries. Any calculation specified for the Filter portal records setting is ignored.
Optional with: –find, –edit, –new, –dup, and –findquery.
Examples
http://localhost/fmi/xml/fmresultset.xml?-db=FMPHP_Sample&-lay=English
&-relatedsets.filter=none&-findany
http://localhost/fmi/xml/fmresultset.xml?-db=FMPHP_Sample
&-lay=English&relatedsets.filter=layout&-relatedsets.max=all&-findany
http://localhost/fmi/xml/fmresultset.xml?-db=FMPHP_Sample&-lay=English
&-relatedsets.filter=layout&-relatedsets.max=10&-findany
Chapter 5 | Valid names used in XML query strings 59
Note For information on filtering portal records, see “–relatedsets.filter (Filter portal records)
query parameter” above.
Examples
http://localhost/fmi/xml/fmresultset.xml?-db=FMPHP_Sample
&-lay=English&relatedsets.filter=layout&-relatedsets.max=all&-findany
http://localhost/fmi/xml/fmresultset.xml?-db=FMPHP_Sample&-lay=English
&-relatedsets.filter=layout&-relatedsets.max=10&-findany
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-script=myscript&-findall
Chapter 5 | Valid names used in XML query strings 60
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-script=myscript&-script.param=Smith%7CChatterjee%7CSu
&-findall
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-script.prefind=myscript&-findall
1 If your query contains more than one –script.prefind.param, then the Web Publishing
Engine uses the last value that it parses.
Optional with: –script.prefind
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-script.prefind=myscript&-script.prefind.param=payroll
&-findall
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-script.presort=myscript&-sortfield.1=dept
&-sortfield.2=rating&-findall
Example
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-script.presort=myscript&-script.presort.param=18%7C65
&-sortfield.1=dept&-sortfield.2=rating&-findall
Chapter 5 | Valid names used in XML query strings 62
Example
The first 10 records in the found set are skipped and records 11 through 15 are returned:
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=departments&-skip=10&-max=5&-findall
Example
The “dept” field is sorted first, and then the “rating” field is sorted. Both fields are sorted in
ascending order because the –sortorder query parameter is not specified.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=performance&-sortfield.1=dept&-sortfield.2=rating&-findall
Chapter 5 | Valid names used in XML query strings 63
<value-list-name> Sort using the specified value list associated with the field on the layout
Example
The sort order of the highest precedence sort field (dept) is ascend, and the sort order of the
second highest precedence sort field (rating) is descend. The precedence-number 2 in -
sortorder.2 specifies that the query parameter -sortorder.2=descend applies to the
-sortfield.2=rating query parameter.
http://192.168.123.101/fmi/xml/fmresultset.xml?-db=employees
&-lay=performance&-sortfield.1=dept&-sortorder.1=ascend
&-sortfield.2=rating&-sortorder.2=descend&-findall
Note If a –sortorder query parameter is not specified for a sort field, the default ascending sort
is used.
Chapter 6
About Custom Web Publishing with PHP
Custom Web Publishing with PHP lets you use the PHP scripting language to integrate data from
FileMaker databases with your customized webpage layouts. Custom Web Publishing with PHP
provides the FileMaker API for PHP, which is a PHP class created by FileMaker that accesses
databases hosted by FileMaker Server. This PHP class connects to the FileMaker Server Web
Publishing Engine and makes data available to your web server’s PHP engine.
1 a web browser and access to the web server to develop and test your Custom Web Publishing
solution
1 PHP installed on the web server—FileMaker Server installs the supported version of PHP, or
you can use your own version
1 For the minimum required version of PHP, see the FileMaker Server technical specifications.
1 For information about PHP, see php.net.
1 The version of PHP installed on the web server must support cURL (client URL library)
functions. For information about cURL, see php.net/curl.
Important When you install FileMaker Server, the supported version of PHP does not show
up in the macOS Server Admin tool; it is not supposed to be listed. If you use the macOS Server
Admin tool to turn on PHP, you disable the FileMaker Server supported version of PHP, and
enable your own version of PHP.
Note For the minimum required version of PHP, see the FileMaker Server technical
specifications. For best results, use the appropriate version of PHP.
To make the FileMaker API for PHP accessible to your PHP scripts
When you installed FileMaker Server, the FileMaker API for PHP package was included as a .zip
file in the following location:
1 For IIS (Windows):
[drive]:\Program Files\FileMaker\FileMaker Server\Web
Publishing\FM_API_for_PHP_Standalone.zip
where [drive] is the drive on which the web server component of your FileMaker Server
deployment resides.
1 For Apache (macOS):
/Library/FileMaker Server/Web
Publishing/FM_API_for_PHP_Standalone.zip
The FM_API_for_PHP_Standalone.zip file contains a file called FileMaker.php and a folder called
FileMaker. Unzip the file and copy the FileMaker.php file and the FileMaker folder to either of these
locations:
1 the folder where your PHP scripts reside.
1 For IIS (Windows) through HTTP or HTTPS:
[drive]:\Program Files\FileMaker\FileMaker Server\HTTPServer\Conf
where [drive] is the drive on which the Web Publishing Engine component of your
FileMaker Server deployment resides.
1 For Apache (macOS) through HTTP:
/Library/FileMaker Server/HTTPServer/htdocs
1 For Apache (macOS) through HTTPS:
/Library/FileMaker Server/HTTPServer/htdocs/httpsRoot
Note When you import a custom SSL certificate, Database Server client connections use
SSL; HTTP connections are routed to HTTPS. With a custom SSL certificate on your server,
use the HTTPS directory for hosting your PHP site files.
1 one of the include_path directories in your PHP installation. The default location for macOS is
/usr/lib/php.
Chapter 6 | About Custom Web Publishing with PHP 67
Note Make sure that you use equivalent FileMaker database privilege sets when developing
PHP solutions that will be given to the end user. Otherwise, you may have access to layouts
and features in the FileMaker database that will not be available to the end user, causing
inconsistent behavior.
2. Use the FileMaker Server CLI to enable Custom Web Publishing with PHP. See
FileMaker Server Help.
3. In Admin Console, confirm that each FileMaker database you’re publishing has the fmphp
extended privilege enabled.
1 In Admin Console, click the Databases page.
1 Select Show Extended Privileges from the menu selector next to All Databases. The text
FMPHP is displayed for databases that have the fmphp extended privilege enabled.
Chapter 7 | Overview of Custom Web Publishing with PHP 69
4. Use PHP authoring tools to create your PHP solution, incorporating the FileMaker API functions
into your PHP code to access your FileMaker data. See chapter 8, “Using the FileMaker API for
PHP.”
5. Copy or move your site directory structure and files to the following folder on the web server of
the master machine.
1 For IIS (Windows) through HTTP or HTTPS:
[drive]:\Program Files\FileMaker\FileMaker Server\HTTPServer\Conf
where [drive] is the drive on the master machine where your FileMaker Server
deployment resides.
1 For Apache (macOS) through HTTP:
/Library/FileMaker Server/HTTPServer/htdocs
1 For Apache (macOS) through HTTPS:
/Library/FileMaker Server/HTTPServer/htdocs/httpsRoot
Note When you import a custom SSL certificate, Database Server client connections use
SSL; HTTP connections are routed to HTTPS. With a custom SSL certificate, use the HTTPS
directory for hosting PHP site files.
6. If a database container field stores a file reference instead of an actual file, the referenced
container object must be stored in the FileMaker Pro Advanced Web folder when the record is
created or edited. You must copy or move the object to a folder with the same relative location
in the root folder of the web server software.
See “About publishing the contents of container fields on the web” on page 15.
7. Make sure that security mechanisms for your site or program are in place.
8. Test your site using the same accounts and privileges defined for web users.
9. Make the site available and known to users. The URL that the web user enters follows this
format:
http://<server>/<site_path>
1 <server> is the machine on which the FileMaker Server resides.
1 <site_path> is the relative path to the homepage for your site, determined by the directory
structure you used in 5 above.
Example
If your web server is 192.168.123.101 and your site homepage is on the web server at
c:\Inetpub\wwwroot\customers\index.php, then the web user would enter this URL:
http://192.168.123.101/customers/index.php
Note PHP uses Latin-1 (ISO-8859-1) encoding. FileMaker Server returns Unicode (UTF-8) data.
Use the CLI to specify the default character encoding. See CLI Help. For PHP sites, you can
specify either UTF-8 or ISO-8859-1; UTF-8 is recommended. Specify the same setting for the
charset attribute in the <HEAD> section of your site PHP files.
For information on deploying and using a PHP solution, see chapter 9, “Staging, testing, and
monitoring a site.”
Chapter 8
Using the FileMaker API for PHP
The FileMaker API for PHP implements a PHP class—the FileMaker class—that provides an
object-oriented interface to FileMaker databases. The FileMaker API for PHP enables both data
and logic stored in FileMaker Pro Advanced databases to be accessed and published on the web,
or exported to other applications.
The FileMaker API for PHP allows PHP code to perform the same kind of functions you already
have available in FileMaker Pro Advanced databases:
1 create, delete, edit, and duplicate records
1 perform find requests
1 perform field and record validation
1 use layouts
1 run FileMaker scripts
1 display portals and related records
1 use value lists
This chapter describes how to use the FileMaker class objects and methods to add these common
functions to a PHP solution. This chapter does not cover the entire the FileMaker API for PHP, but
introduces key objects and methods.
Command Create commands that add records, delete records, duplicate records, edit records,
perform find requests, and perform scripts
Important Commands have different return values, as defined by the FileMaker.php class.
For example, some commands return the Boolean value TRUE or a FileMaker_Error object. Other
commands return a FileMaker_Result object that could contain an entire “found set” of records in
a layout. To avoid computer memory overload problems, be aware of the expected return values
of the commands you use. See the “FileMaker API for PHP Reference” on page 71 for detailed
information about return values for each command.
Chapter 8 | Using the FileMaker API for PHP 73
The basic tasks that most PHP applications need to perform are described in the following:
1 “Working with records” on page 74
1 “Running FileMaker scripts” on page 76
1 “Performing find requests” on page 82
Example
$user = urldecode($_GET['user']);
$event = urldecode($_GET['event']);
Note Avoid using strings that include ampersand (&) characters with the FileMaker API for PHP.
Use a backslash as an escape character before special characters in strings passed to the
FileMaker API for PHP.
Examples
Note The hostspec property defaults to the value http://localhost. Because the PHP
engine is installed with the master machine’s web server component, there is no need to specify
the hostspec property.
Chapter 8 | Using the FileMaker API for PHP 74
Creating a record
There are two ways to create a record:
1 Use the createRecord() method, specifying a layout name, and optionally specifying an
array of field values. You can also set values individually in the new record object.
The createRecord() method does not save the new record to the database. To save the
record to the database, call the commit() method.
Example
Using the FileMaker_Record commit() method, the $result variable is assigned the
Boolean value TRUE and the new record is created in the FileMaker database when there are
no errors.
If an error occurs, the variable $result contains a FileMaker_Error object. Check for errors
after executing the commit() method.
1 Use the Add command. Use the newAddCommand() method to create a
FileMaker_Command_Add object, specifying the layout name and an array with the record
data. To save the record to the database, call the execute() method.
Example
Duplicating a record
Duplicate an existing record using the Duplicate command. Use the newDuplicateCommand()
method to create a FileMaker_Command_Duplicate object, specifying the layout name and the
record ID of the record that you want to duplicate. Then, duplicate the record by calling the
execute() method.
Chapter 8 | Using the FileMaker API for PHP 75
Example
Editing a record
There are two ways to edit a record:
1 Using the Edit command. Use the newEditCommand() method to create a
FileMaker_Command_Edit object, specifying the layout name, the record ID of the record you
want to edit, and an array of values that you want to update. Then, edit the record by calling the
execute() method.
Example
1 Using a record object. Retrieve a record from the database, change field values, and then edit
the record by calling the commit() method.
Example
Deleting a record
There are two ways to delete a record:
1 Retrieve a record from the database, and then call the delete() method.
Example
1 Delete an existing record using the Delete command. Use the newDeleteCommand() method
to create a FileMaker_Command_Delete object, specifying the layout name and the record ID
of the record you want to delete. Then, delete the record by calling the execute() method.
Example
Example
$scripts = $fm->listScripts();
Important When running a FileMaker script, the size of the FileMaker_Result object that is
returned depends on behavior of the FileMaker script. For example, if a FileMaker script switches
to a specified layout, then all of the records from that layout’s table may be in the found set, and
all of the records in that found set could be returned in the FileMaker_Result object. To avoid
computer memory overload problems, be aware of the data returned by a FileMaker script before
running that FileMaker script in a PHP application.
Example
Example
$findCommand = $fm->newFindCommand('Students');
$findCommand->addFindCriterion('GPA', $searchValue);
$findCommand->setPreCommandScript('UpdateGPA');
$result = $findCommand->execute();
Chapter 8 | Using the FileMaker API for PHP 77
Example
$findCommand = $fm->newFindCommand('Students');
$findCommand->setPreSortScript('RemoveExpelled');
Example
$findCommand = $fm->newFindCommand('Students');
$findCommand->setScript('myScript','param1|param2|param3');
4. Sort the Find result set, if the addSortRule() method was specified.
Example
request = $fm->newFindCommand('Students');
$request->addFindCriterion('Day', 'Wednesday');
if (FileMaker::isError($result)) {
if ($result->code = 401) {
$findError = 'There are no Records that match that request: '. ' (' .
$result->code . ')';
} else {
$findError = 'Find Error: '. $result->getMessage(). ' (' . $result->code
. ')';
}
}
$request->setResultLayout(’Teachers’);
// Switch to the result layout
$result = $request->execute();
Using portals
A portal is table that displays rows of data from one or more related records. The FileMaker class
defines a related set object and several methods that allow you to work with portals defined in a
FileMaker Pro Advanced database.
A related set object is an array of record objects from the related portal; each record object
represents one row of data in the portal.
Example
$tableNames = $currentLayout->listRelatedSets();
Example
$relatedSetsNames = $result->getRelatedSets();
Example
$relatedSetsArray = $currentLayout->getRelatedSets();
Example
$relatedSet = $currentLayout->getRelatedSet('customers');
Chapter 8 | Using the FileMaker API for PHP 80
Example
$tableName = $relatedSet->getName();
Example
$relatedRecordsArray = $currentRecord->getRelatedSet('customers');
Example
$result = $new_row->commit();
Example
$relatedSet = $currentRecord->getRelatedSet('customers');
/* Runs through each of the portal rows */
foreach ($relatedSet as $nextRow) {
$nameField = $nextRow->getField('customer::name')
if ($nameField == $badName ) {
$result = $newRow->delete();
}
}
Chapter 8 | Using the FileMaker API for PHP 81
Example
$valueListNames = $currentLayout->listValueLists();
Example
$valueListsArray = $currentLayout->getValueListsTwoFields();
Note Although the getValueLists() method is still supported in the FileMaker API for PHP,
it will be deprecated. Instead, use the getValueListsTwoFields() method.
Use an iterator with the getValueListTwoFields() method to find the displayed value and
stored value.
Example
$layout = $fm->getLayout('customers');
$valuearray = $layout->getValueListTwoFields("region", 4);
foreach ($valuearray as $displayValue => $value) {
....
}
Notes
1 Although the getValueList() method is still supported in the FileMaker API for PHP, it will
be deprecated. Instead, use the getValueListTwoFields() method.
1 When using the getValueListTwoFields() method, be sure to use a foreach loop to
loop through the associative array. Do not use a for loop because it can return unexpected
results.
Example
Note When using the Find All command, avoid computer memory overload problems by
specifying a default maximum number of records to return per page.
Example
Note Make sure the layout name is unique. If your database has two layouts with the same
name, the FileMaker API for PHP cannot distinguish between them. In addition, the API is not case
sensitive. For example, if your database has one layout named Websites and another layout
named WebSites, the API cannot distinguish between them.
Chapter 8 | Using the FileMaker API for PHP 84
Use the addFindCriterion() method to add criteria to the find request. Use the
clearFindCriteria() method to clear all find criteria that have been defined.
Examples
Example
Note The Filter portal records setting in the Portal Setup dialog box is not supported for PHP
queries. Any calculation specified for the Filter portal records setting is ignored.
1 four-digit year
Valid data is a character string representing a date with a four-digit year in the format
M/D/YYYY, where M is a number between 1 and 12 inclusive, D is a number between 1 and 31
inclusive, and YYYY is a four-digit number between 0001 and 4000 inclusive. For example,
1/30/3030 is a valid four-digit year value. However, 4/31/2019 is an invalid four-digit year
value because April does not have 31 days. Date validation supports forward slash (/), back
slash (\), and hyphen (-) as delimiters. However, the string cannot contain a mix of delimiters.
For example, 1\30-2019 is invalid.
1 time of day
Valid data is a character string representing a 12-hour time value in the one of these formats:
1 h
1 h:m
1 h:m:s
1 h:m:s AM/PM
1 h:m AM/PM
where h is a number between 1 and 12 inclusive; m and s are numbers between 1 and 60
inclusive.
The PHP engine prevalidation supports implicit checking of field data based on the type of the
field:
1 date
A field defined as a date field is validated according to the rules of “four-digit year” validation,
except the year value can contain 0-4 digits (the year value can be empty). For example, 1/30
is a valid date even though it has no year specified.
1 time
A field defined as a time field is validated according to the rules of “time of day” validation,
except the hour component (H) can be a number between 1 and 24 inclusive to support 24-hour
time values.
1 timestamp
A field defined as a timestamp field is validated according to the rules of “time” validation for the
time component and according to the rules of “date” validation for the date component.
The FileMaker class cannot prevalidate all of the field validation options that are available in
FileMaker Pro Advanced. The following validation options cannot be prevalidated because they
are dependent on the state of all the data in the database at the time that the data is committed:
1 unique value
1 existing value
1 in range
1 member of value list
1 validate by calculation
Chapter 8 | Using the FileMaker API for PHP 89
Prevalidating records
For a record object, use the validate() method to validate one field or all the fields in the record
against the prevalidation rules enforceable by the PHP engine. If you pass the optional field name
argument, only that field is prevalidated.
If the prevalidation passes, then the validate() method returns TRUE. If the prevalidation fails,
then the validate() method returns a FileMaker_Error_Validation object containing details
about what failed to validate.
Prevalidating fields
For a field object, use the validate() method to determine whether a given value is valid for a
field.
If the prevalidation passes, then the validate() method returns TRUE. If the prevalidation fails,
then the validate() method returns a FileMaker_Error_Validation object containing details
about what failed to validate.
2. A validation constant value that indicates the validation rule that failed:
1 - FILEMAKER_RULE_NOTEMPTY
2 - FILEMAKER_RULE_NUMERICONLY
3 - FILEMAKER_RULE_MAXCHARACTERS
4 - FILEMAKER_RULE_FOURDIGITYEAR
5 - FILEMAKER_RULE_TIMEOFDAY
6 - FILEMAKER_RULE_TIMESTAMP_FIELD
7 - FILEMAKER_RULE_DATE_FIELD
8 - FILEMAKER_RULE_TIME_FIELD
3. The actual value entered for the field that failed prevalidation
Chapter 8 | Using the FileMaker API for PHP 90
You can also use the following methods with a FileMaker_Error_Validation object:
1 Use the isValidationError() method to test whether the error is a validation error.
1 Use the numErrors() method to get the number of validation rules that failed.
Example
//If the validate() method returned any errors, print the name of the field,
the error number, and the value that failed.
if(FileMaker::isError($result)){
echo 'Validation failed:'. "\n";
$validationErrors= $result->getErrors();
foreach ($validationErrors as $error) {
$field = $error[0];
echo 'Field Name: ' . $field->getName(). "\n";
echo 'Error Code: ' . $error[1] . "\n";
echo 'Value: ' . $error[2] . "\n";
}
}
Result
Validation failed:
Field Name: numericonly
Error Code: 2
Value: abc
Field Name: maxchars
Error Code: 3
Value: abcx
Chapter 8 | Using the FileMaker API for PHP 91
Handling errors
The FileMaker class defines the FileMaker_Error object to help you handle errors that occur in a
PHP solution.
An error can occur when a command runs. If an error does occur, the command returns a
FileMaker_Error object. It is a good practice to check the error that is returned when a command
runs.
Use the following methods to learn more about the error indicated in the FileMaker_Error object.
1 Test for whether a variable is a FileMaker Error object by calling the isError() method.
1 Get the number of errors that occurred by calling the numErrors() method.
1 Retrieve an array of arrays describing the errors that occurred by calling the getErrors()
method.
1 Display an error message by calling the getMessage() method.
Example
$result = $findCommand->execute();
if (FileMaker::isError($result)) {
echo "<p>Error: " . $result->getMessage() . "</p>";
exit;
}
For information about the error codes returned with the FileMaker Error object, see appendix A,
“Error codes for Custom Web Publishing.”
Chapter 9
Staging, testing, and monitoring a site
This chapter provides instructions for staging and testing a Custom Web Publishing site before
deploying it in a production environment. Instructions are also provided for using log files to
monitor the site during testing or after deployment.
1. Complete all of the steps outlined in chapter 2, “Preparing databases for Custom Web
Publishing.”
2. Check that Custom Web Publishing has been enabled and properly configured using the CLI.
See FileMaker Server Help.
3. Verify that the web server and the Web Publishing Engine are running.
4. Copy or move your site files to the web server component of your FileMaker Server
deployment.
Copy or move your site files to the following directory:
1 IIS (Windows) through HTTP or HTTPS:
[drive]:\Program Files\FileMaker\FileMaker Server\HTTPServer\Conf
where [drive] is the drive of your FileMaker Server master machine.
1 Apache (macOS) through HTTP:
/Library/FileMaker Server/HTTPServer/htdocs
1 Apache (macOS) through HTTPS:
/Library/FileMaker Server/HTTPServer/htdocs/httpsRoot
Note When you import a custom SSL certificate, Database Server client connections use
SSL; HTTP connections are routed to HTTPS. With a custom SSL certificate, use the HTTPS
directory for hosting PHP site files.
Chapter 9 | Staging, testing, and monitoring a site 93
5. If you have not already done so, copy or move any referenced container field objects to the
appropriate directory on the master machine.
1 If the database file is properly hosted and accessible on the Database Server component of
the FileMaker Server deployment, and the container fields store the actual files in the
FileMaker database, then you don’t need to relocate the container field contents.
1 If a database container field stores a file reference instead of an actual file, then the
referenced container object must be stored in the FileMaker Pro Advanced Web folder when
the record is created or edited. To stage your site, you must copy or move the referenced
containers to a folder with the same relative location in the root folder of the web server
software.
1 When you use FileMaker Pro Advanced to upload a database with container fields that store
objects externally, the externally stored container field data is uploaded to FileMaker Server
as part of the process. See FileMaker Pro Advanced Help for information on transferring the
database files to FileMaker Server.
1 When you manually upload a database that uses a container field with externally stored
objects, then you must copy or move the referenced objects into a subfolder of the
RC_Data_FMS folder, as described in “Container fields with externally stored data” on
page 16.
6. Copy any additional components of your web application to the master machine. For Custom
Web Publishing with XML, your web application processes the XML data before sending it to
another application or to the client.
Note You can view and test your site on the master machine without using a network
connection by using http://127.0.0.1/ in the URL.
Here are two examples of XSLT stylesheets that are useful for testing XML output.
The following stylesheet example outputs the requested XML data without doing any
transformation. This stylesheet is useful for displaying the actual XML data that the Web
Publishing Engine is using.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmrs="http://www.filemaker.com/xml/fmresultset">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
When debugging a stylesheet, you can use the following example of an HTML <textarea> tag
to display the XML source document that was accessed via the stylesheet in a scrolling text
area.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmrs="http://www.filemaker.com/xml/fmresultset">
<xsl:output method="html"/>
<html>
<body>
<xsl:template match="/fmrs:fmresultset">
<textarea rows="20" cols="100">
<xsl:copy-of select="."/>
</textarea><br/>
</xsl:template>
</body>
</html>
</xsl:stylesheet>
Chapter 9 | Staging, testing, and monitoring a site 95
Note For information on the W3C Common Logfile Format and the W3C Extended Log File
Format, see the World Wide Web Consortium website at www.w3.org.
1 [MODULE_TYPE] is either: XML, for Custom Web Publishing with XML requests, or PHP, for
Custom Web Publishing with PHP requests.
1 [SEVERITY] is either INFO, indicating an informational message, or ERROR, indicating an
error message.
1 [FM_ERROR_CODE] is the error number returned for an error message. The error number may
be an error code for FileMaker databases (see “Error code numbers for FileMaker databases”
on page 99).
In addition, the error number may be an HTTP error number, prefixed by an “HTTP:” string.
1 [RETURN_BYTES] is the number of bytes returned by the request.
1 [MESSAGE] provides additional information about the log entry.
Examples
The following examples show the types of messages that may be included in the wpe.log file.
Scripting errors:
2019-06-02 17:33:12 -0700 WPC_SERVER 192.168.100.101:0 jdoe - ERROR
4 - Web Scripting Error: 4, File: "10b_MeetingsUpload", Script: "OnOpen",
Script Step: "Show Custom Dialog"
System errors:
2019-06-02 15:30:42 -0700 WPC_SERVER 192.168.100.101:0 jdoe XML
ERROR - - Communication failed
Chapter 9 | Staging, testing, and monitoring a site 97
Examples
It is up to you, as the developer of the Custom Web Publishing solution, to check the value of the
<error code> or <ERRORCODE> element and handle it appropriately. The Web Publishing
Engine does not handle database errors.
Appendix A | Error codes for Custom Web Publishing 99
Example
N portals
adding records 45
name attribute 31 deleting records 46
namespaces for XML 28 editing records 46
new features in Custom Web Publishing 21 initial row 58
–new query command 50 layout 58
newAddCommand() method 74 number of records 58
newCompoundFindCommand() method 84 sorting records 58
newDeleteCommand() method 75 use in PHP 79
newDuplicateCommand() method 74 prevalidation
newEditCommand() method 75 commands 87
date 88
newFindAllCommand() method 83
fields 89
newFindAnyCommand() method 83
four-digit year 88
newFindCommand() method 83 maximum number of characters 87
newFindRequest() method 84 not empty 87
newPerformScriptCommand() method 76 numeric only 87
newRelatedRecord() method 80 records 89
non-empty field 87 time 88
not-empty attribute 31 time of day 88
Number of rows setting 58, 87 timestamp 88
numbers for database error codes 98 privilege set, assigning for Custom Web Publishing 13
numeric only field 87 processing a result set 86
numeric-only attribute 31 processing a Web Publishing Engine request 10
numErrors() method 90, 91 progressive download 17
protecting published databases 14
O publishing on the web
connecting to Internet or intranet 22
online documentation 8 container field objects 15
operators, comparison 53 database error codes 98
order of XML request processing 41 protecting databases 14
out of memory error 18 requirements for 21
overview using XML 25
Custom Web Publishing 9
steps for XML data access 25 Q
–query query parameter 56
P query strings
parameters for queries. See query strings adding records to portals 45
passwords commands and parameters 38, 42
Basic Authentication for web users 13 editing records in portals 46
Change Password script 14 fully qualified field name, syntax of 45
defining for Custom Web Publishing 13 global fields, syntax of 47
no login password 14 guidelines for 43
PDFs 8 requesting XML data 38, 42
performing find requests 82 querying portal fields 46
PHP
Custom Web Publishing, described 11 R
enabling in a database 13
–recid query parameter 57
site homepage 69
record object 74
supported version 66
PHP advantages 12
PHP version 65
plug-ins 18
portal field queries 58, 59
Index 104
validation X
commands 87
date 88 XML
fields 89 advantages 11
four-digit year 88 Custom Web Publishing, described 11
maximum number of characters 87 document type definitions (DTDs) 29, 33
not empty 87 enabling in a database 13
numeric only 87 encoded using UTF-8 format 28, 38
records 89 FMPXMLLAYOUT grammar 35
time 88 FMPXMLRESULT grammar 33
time of day 88 fmresultset grammar 30
timestamp 88 <datasource> element 30
value lists <field-definition> element 31
use in PHP 81 <metadata> element 31
use in XML 35 <relatedset-definition> element 31
<resultset> element 31
–view query command 51
generating XML data from request 24
grammars compared 28
W namespaces for 28
web browser’s role in XML requests 24 order of request processing 41
Web folder, copying container field objects 16 parsers 25, 38
Web Publishing Core illustrated 24 query strings 38, 42
request, specifying layout 40
Web Publishing Engine
requesting data 25
application log 95
response, switching layout 40
benefits of 20
summary of steps for accessing XML data 25
described 10
troubleshooting access to XML documents 41
generated error codes 98
URL text encoding 27
generating XML data 24
XML 1.0 specification 23
generating XML documents 25
request processing 10 <xsl:stylesheet> element 94
web server <xsl:template> element 94
log files 95
MIME type support 15
role in XML requests 24
web users
accessing protected databases 13
requirements for accessing Custom Web Publishing
solutions 21
using container field data 17
web_server_module_log.txt log file 97
websites
creating with Web Publishing Engine 20
FileMaker support pages 8
monitoring 95
testing 93