Posts from the 'Web Developer' Category

Use FileMaker Pro 9 to connect to a SQL / MySQL data source

One of the really powerful features of FileMaker Pro 9 is the ability to connect directly to an SQL data source. This means you can create a FileMaker 9 interface for your clients and allow them to add/modify/browse/delete records on a SQL data source.

Setting up FileMaker Pro 9 to connect to a SQL data source is actually a little more complicated than the FileMaker marketing would have you believe. In this short tutorial, we’ll talk you through the steps of connecting to a MySQL data source using FileMaker Pro 9 on a Mac and Actual Technology’s ODBC drivers (yep, you need third party software – surprised?)

There are two steps to setting up your FileMaker to MySQL connection:

1) Set up your ODBC preferences
2) Set up FileMaker Pro 9

1) Set up your ODBC preferences

The first thing to do here is to go to Actual Technologies and get a copy of the ODBC driver you require. (NB. Metaclarity is not affiliated with Actual Technologies in any way – we just like their software). We’re running MySQL so we bought a copy of the Open Source Databases driver. If you don’t want to spend money on a driver there are some free drivers available on the internet, but for $29 Actual will make your task a LOT easier.

  • Run the Actual ODBC Driver Pack installer
  • Go through the legal steps then click customize and choose the driver you want to install: we only installed the “Actual ODBC Driver for Open Source Databases” as that was all we required to connect to MySQL
  • With the installation finished successfully go to the Utilities folder on your drive and open the application called: “ODBC Administrator”
  • Click on User DSN then click on the “Add… button”
  • Select Actual’s Driver in the list that appears.
  • Press “Continue” in the new pop-up window.
  • Choose an easy to remember name for your connection and description – these are not critical to the connection. For DSN type, choose System.
  • Choose your database type (here we chose MySQL)
  • Enter the IP for your MySQL server in the Server field. Port is usually 3306.
  • Set your username and password for connecting to your online MySQL database in Login ID and Password.
  • In the next window the name of your database should be available in the Database popup field. Select it now then press continue. Then press “Done”

Now in the ODBC Administrator application under the System DSN tab you’ll see your data source and you’re ready to connect with FileMaker Pro 9

2) Set up FileMaker Pro 9 to connect to SQL / MySQL

  • Launch FileMaker Pro 9
  • Create a new empty database.
  • Open the define database dialog: File>Manage>Database…
  • Go to Relationships and double click on the existing “test” table
  • For Data Source, choose Add ODBC data source….
  • Choose your MySQL source from the list and press “Continue…”
  • Most of the defaults in the following screen are fine though if you don’t want to be prompted for a password each time you connect then use “Specify user name and password”
  • Now choose the table you want to connect to and read. Your table will populate with the fields from this remote table.
  • Press OK and watch what happens – you’re using FileMaker Pro 9 to access a remote SQL data source! You can now use FileMaker’s layout functions etc. to make this layout more attractive and get to work on learning how to better integrate Filemaker Pro 9 and MySQL!

Customize a SMF forum to look like your site

SMF (Simple Machines Forum) is a standard install for many users of Fantastico. It’s a robust, easy to configure, PHP/MySQL-based discussion forum that is common all over the web. What’s more, there are lots of templates available to allow you to customize the look of your SMF forum. These templates vary greatly from the austere to the plain bizarre, but what if you want your SMF forum to fit nicely into your existing website? Read on…

[Note: this article requires familiarity with HTML/CSS and a bit of PHP]

A client of ours recently asked us to do precisely that – take the SMF back end and fit it into the site we had built for him. Well, after some rummaging around in the SMF installed files we discovered that you only need to modify one PHP file and add a few CSS tweaks in order to get the forum fitting into your website. (We’ll show you our own results here as soon as the site in question goes live.) Meanwhile, here’s how you do it.

Step 1: set up SMF with a new theme

  • Install a SMF forum on your site (use Fantasico if you can – it’s really easy)
  • Now find a forum theme that is close to what you want for your site. There are hundreds of themes here. Many more can be found by doing a quick internet search.
  • Download the .ZIP file of the theme you like then login into your SMF administrator interface.
  • In the sidebar click on “Themes and Layouts” and follow the instructions to install your theme from the .ZIP file (no need to decompress). The options are at the bottom of the page.
  • Set the newly installed theme as the default theme for your site: “Overall forum default” and “Reset everyone to” [name of your theme]. At the same time, make sure users can’t chose to modify their viewing theme or they might break out of your modifications. This is done by unchecking “Allow members to select their own themes” and “Allow members to select the “Default” theme.” Now they can only use your theme.

Step 2: modify the index.template.php file

  • FTP into your web site and navigate to the location where you installed SMF. In there is a folder called “Themes” and in it you should see a file called “index.template.php” This is the only file you’ll need to modify to get your SMF forum wrapped up in you site.
  • The HTML of you document is buried quite deep in PHP tags but it should be navigable. Start by adding links to your CSS file(s) in the head of the page.
  • To modify the HTML, we wrapped the whole content of the body tag in our standard page template and it worked great. Give it a go!
  • If you’re using a CSS file for your site with a global reset that removes all padding and margins from HTML elements, including table, tr and td’s, you may find that it ruins the formatting of your tables in your forum. The solution? Create a separate stlye sheet for your forum that does not include table, tr and td zeroing.
  • Your forum should now look like your site

Step 3: final adjustments

  • Return to the SMF admin interface and click on “Current Theme” in the sidebar. Rename your theme to the name of your site.
  • Walk through the SMF admin interface setting up any other options you require – it’s pretty simple.

And that’s it. Your forum is now wrapped up in your site template – it’s really that simple!

Get web design training in New York

Filemaker Pro and ImageMagick

Filemaker Pro can store images in container fields. Wouldn’t it be great if it could also perform standard image manipulations on those stored images? Well with a combination of Filemaker Pro, ImageMagick and a little UNIX scripting, you can.

Here’s how:

1) Install ImageMagick on your system

2) Create a Filemaker Pro database with fields similar to the ones in the example file below or simply use our example

3) Copy the script from the example records below into your own version and Process your images.

Here’s the working example to download:
Filemaker and ImageMagick Example

You can also run ImageMagick image processing with AppleScript using “do shell script”. Here’s an example:

do shell script "cd ~/; ls"
do shell script "cd ~/; export MAGICK_HOME=\"$HOME/ImageMagick-6.3.2\" ;export PATH=\"$MAGICK_HOME/bin:$PATH\" ;export DYLD_LIBRARY_PATH=\"$MAGICK_HOME/lib\"; convert donj.bmp donj.jpg"