Estimated Time To Read This: 4 – 6 minutes
FileMaker Inc. recently released version 8.5 of its FileMaker Pro and FileMaker Pro Advanced software. One of the new features, the web viewer control, is essentially a mini web browser that you can drop on any FileMaker layout. There are limitations; for instance, you don’t have the full set of controls that you’d get in a full fledged browser (you have to build forward and back buttons if you want them) but it still allows you to view content from the web in your FileMaker solutions, which opens up an array of opportunities. You can view a map to a client location using Google maps, check out the weather forecast using Weatherbug, look up product information on Amazon, or track packages using UPS.
To add a web viewer to a layout, select it from the Status Area (it’s located in the same area as the tab and button controls), and drag a rectangle on the layout (similar to adding a portal or button). Once you do this, the Web Viewer Setup dialog pops up. FileMaker has provided templates for several popular websites (Google Maps, Wikipedia, etc.) on the left. Simply select one of these and fill out the information on the right (enter either static text, or specify a field or calculation.) The area at the bottom allows you to enter your own URLs; again these can be static, or you can click on the Specify button to bring up a calculation dialog.
While you can get a lot of mileage from the web viewer using existing websites, you can also customize your application by building your own web pages to display in the web viewer. These can be straightforward HTML pages, but a more interesting use is to utilize Custom Web Publishing to pull data from your FileMaker database, and manipulating it using XSLT, PHP, Flash, etc. For the purpose of this article, another recently announced product from FileMaker, the PHP API was used (currently in beta at this point) to pull data from a record in a database and view it as a bar chart.
The database is a simple contact management solution (company, contacts, follow-ups), along with a table called sales, which just holds a sales amount for a given month. In order to pull the data into a webpage two new layouts were created (one called web_company, another called web_sales). In addition, a new user account and privilege set were created to be used solely for web publishing. The privilege set needs to have an extended privilege called fmphp for FileMaker’s PHP API to access the database. Note: you will need to host the file on FileMaker Server Advanced 8.0v4 in order to access the data with the PHP API. Also, you will need to have PHP 4.3.x or higher installed on your web server, with cURL support enabled.
Next the webpage was built. In order to save time, www.phpclasses.org was searched for a Bar Graph class (found here). The sample index page came with code to generate a simple bar graph. The only change that had to be made was to pull the data from the sales data. The primary key for the company was used to search the sales table (finding all the sales for the selected Company), and store the data returned in an array, which was then passed to the bargraph class. The company table was also searched to get the company name to use in the bargraph’s title.
Once this was set up and tested, it was time to set up the web viewer. A calculation was created to build the URL for the viewer as follows: “http://localhost/graph/index.php?id=” & Company::zk_companyID_pk.
The URL is pretty simple; ‘http://localhost/graph/index.php’ is just the URL of the page created; ‘id=” & Company::zk_companyID_pk’ passes the company’s primary key to the PHP page so it can be used in the search. Switching to browse mode, we then see the results of the page.
Of course, this was just a quick example that barely scratches the surface of what is possible with these technologies. Once you are comfortable with PHP and FileMaker’s API, you can leverage PHP’s functionality, and use PHP resources on the web (such as phpclasses.org or sourceforge.net) to enrich your FileMaker solutions.
Alan Bruce









