preload
6 Comments | Feb 01, 2011

PHP Site Assistant

Estimated Time To Read This: 2 – 4 minutes      


I’ve spent a lot of time over the last few years building websites in PHP using FileMaker as a back end (starting with Chris Hansen’s FX.PHP, then switching over to FileMaker’s own PHP API) but I’d never really used FileMaker’s built-in PHP Site Assistant. Since I am used to coding everything myself  I never really saw the need for it, but I decided to try it out recently just as a test to see how it works.

The Site Assistant can be started from a couple of places. On the FileMaker server admin page, click on PHP Site Assistant and XSLT Site Assistant Tools, and on the subsequent page click on Start PHP Site Assistant. You can also run it from the Tools menu in FileMaker Advanced. From there, it’s pretty straightforward to use: select your database server, then select a database. The assistant then asks you to choose a Layout Group – basically, it lists all table occurrences in the file that have layouts associated with them, and you have to choose one. That’s one of the big limitations; the site has to be based on a single table (although you can work around this to an extent by using related fields and portals to display related data).

You then pick a site profile which determines which web pages are created. Again, kind of limited; there are only a handful of profiles available. It would be nice if you could just select which pages you want. You tweak the pages a bit by selecting which fields are displayed on which one, and in which order, but that’s about the extent of it.

The PHP code that’s generated seems to be pretty well written, though it may be tough to follow if you aren’t used to using object-oriented code in PHP. One of the annoying things I found is that they don’t specify the address for the FileMaker server anywhere in the code, so if your website is on a different machine than your FileMaker server, you’ll have to add this in to every page. Another small gripe is that the main page is called home.php rather than the standard index.php. Maybe it’s not a big deal, but most web servers are set up to look for index.php as the home page for a site, so it would have been nice if they had followed suit.

They do include several themes to set the look of your page; the one that intrigues me the most is the iPhone one. I kind of like this one – it gives you a pretty nice, iPhone looking interface for the site; in fact this is one of the main uses I can see (at least for me) – setting up a quick, iPhone-accessible website for a FileMaker database. The actual web pages that are produced do work pretty well, and setting up a website using the wizard doesn’t take a lot of time, so it seems to be a pretty good option for this.


Tags:, , , , , , , ,





Related Articles


6 Comments

Hal Gumbert 10:07 am - 2nd February:

Hi Alan,

I was wondering if you’ve tried to combine exported sites for the same database.

Let’s say you export a site for Contacts and a site for Invoices. I believe that if you do so, you need to login to Contacts and then if you switch to Invoices, you must login again.

Do you know what steps must be taken to combine the login info for the sites so only one login is required?

Alan Bruce 12:06 pm - 2nd February:

I haven’t played around with this too much, but I did try it out quickly. It looks like the user name and password are stored in Session variables (if you aren’t familiar with PHP, Sessions let you carry data from one page to another in PHP). In the sites created by the Site Assistant, most of this seems to be handled in the FMView.php file; in fact, one of first lines in the file sets the name of the session ( session_name(“abcd”) ); if you set the session name to be the same for every site, that looks like it takes care of the problem.

Hal Gumbert 2:24 pm - 2nd February:

Thanks Alan!

I just tried exporting two sites, made the session names match and I was able to jump from site to site without logging back in!

Use the PHP Site Assistant a bit, but not too much. Updating the session name makes it easier to use…

JA 7:32 pm - 4th February:

…they don’t specify the address for the FileMaker server anywhere in the code, so if your website is on a different machine than your FileMaker server, you’ll have to add this in to every page

Can you point to a document or blog post that explains where to add and what to add?

JA

Alan Bruce 9:27 am - 7th February:

The first time I heard about this was in Kurt Bowman’s Devcon session about FIleMaker and the iPhone a couple of years back; I found a copy of the slides from the presentation online at http://www.docstoc.com/docs/13449041/iPhone-Session-v3. Look around slide number 19 for his notes on he code to add to the page (there are some other good tips in those slides as well).

There’s also a form post I found at fmforums that details another way to handle this, you can find it at http://fmforums.com/forum/topic/72667-moving-generated-site-to-remote-server/.

Trackbacks

  1. [...] few months back, I wrote a post about FileMaker’s built in PHP Site

Leave a Reply

* Required
** Your Email is never shared