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!

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”

Filemaker Pro AppleScript - Part 1

If you are a Filemaker Pro developer working on Macs will know that this versatile database has had AppleScript support built in for many years. It’s a versatile and simple way to extend the functionality of Filemaker Pro allowing you to perform complex scripting tasks within the application or even link Filemaker Pro to other applications.

If you’re coming to Filemaker Pro Applescript for the first time, these script samples will hopefully help you get started.

—–

Let’s assume we’ve built a Filemaker database called “mcContacts” with a table called “Contacts” and four fields: “First Name”, “Last Name”, “email” and “Postal Code”

You can download the sample database here

How to create a new record:

tell application "FileMaker Pro"

 create new record in database "mcContacts"

end tell

How to create a new record and insert content:

tell application "FileMaker Pro"

 set newRecord to create new record in database "mcContacts"

 tell newRecord

 	set cell "First Name" to "Henry"

 	set cell "Last Name" to "Higgins"

 	set cell "Postal Code" to "HH1 3HH"

 	set cell "email" to "hhiggins@email.com"

 end tell

end tell

How to modify the current record:

set newFirstName to "Horace"

set newLastName to "Walpole"

tell application "FileMaker Pro"

 set cell "First Name" of current record to newFirstName

 set cell "Last Name" of current record to newLastName

end tell

How to get and display information from a record:

tell application "FileMaker Pro"

 tell database "mcContacts"

 	set firstName to the contents of field "First Name" of current record

 	display dialog "First Name in this record is: " & firstName

 end tell

end tell

How to delete the current record:

tell application "FileMaker Pro"

 tell database "mcContacts"

 	delete current record --be careful, there's no warning

 end tell

end tell

How to search for a record:



tell application "FileMaker Pro"

 tell database "mcContacts"

 	show (every record whose cell "First Name" = "Henry")

 end tell

end tell

How to search for a record with multiple search terms:



tell application "FileMaker Pro"

 tell database "mcContacts"

 	show (every record whose cell "First Name" = "Henry" and cell "Last Name" = "Higgins")

 end tell

end tell

How to show all records:

tell application "FileMaker Pro"

 tell database "mcContacts"

 	show every record

 end tell

end tell

How to sort the current records:

tell application "FileMaker Pro"

 tell database "mcContacts"

 	sort layout "Contacts" by field "Last Name" in order ascending

 end tell

end tell

How to show a particular record:

tell application "FileMaker Pro"

 tell database "mcContacts"

 	show record 2

 end tell

end tell

Also useful - perform a menu command:

tell application "FileMaker Pro"

 do menu menu item "Hide Window" of menu "Window"

end tell

Also useful - perform a script:

tell application "FileMaker Pro"

 tell database "mcContacts"

 	do script "Test"

 end tell

end tell

Finally, how to get Filemaker to make the tea:

tell application "FileMaker Pro"

 tell Metaclarity CEO "Paul Tuckey"

 	go an make the tea with delay 0

 end tell

end tell

We hope this helps you get up and running with AppleScript and Filemaker Pro. Stay tuned - we’ll be publishing Part 2 very soon!