FormBoss 2 Documentation
Top Link
Editor - PHP Export Path

In Brief: New in Build 610, this feature lets you have an easier time using the PHP include method for embedding FormBoss forms in your pages. The general principal is on a page in your web site you would include a form with a name of php_include as such:

<?php include 'output/forms/php_include/page0.php'; ?>

The trick with this is that the Form which resides at: output/forms/php_include/ needs to include several files to work. For example, we need to include our XML job validation file, and when we click submit, we need to go to the correct page. The problem is that the way PHP includes work; the first page to include becomes the 'base' include path, and every file included after that assumes the included pages are relative to that first page.

This means that out first call to include the form on our root page becomes the base, and our subsequent calls to include file after that will be wrong, because they are not relative to the root call, but the FormBoss job folder, in this case php_include.

It is for this reason and others that the recommended way to embed FormBoss jobs is to use the iFrame include method. iFrames are a web standard, totally acceptable way to perform such a task. While already robust, in recent builds the iFrame method has been strengthened further with the inclusion of two new properties: Page PHP Header Template Code and Page PHP Footer Template Code, which aim to make creating whole page forms with included headers and footers directly in FormBoss easier.

However, if you still want to use the PHP include method, the PHP Export Path was created to make your task easier.

The PHP Export Path is simply the path to the FormBoss job folder relative to the Forms final include point. There is one main caveat though, the names of the form pages in the job folder must match the names of the pages your including the FormBoss pages on.

For example, if we had a web site with:

/public_html/page1.php
/public_html/page2.php

And the FormBoss job at:

/public_html/formboss/output/forms/php_include/

We would use this for the include on /public_html/page1.php:

<?php include 'formboss/output/forms/php_include/page1.php'; ?>

And for /public_html/page2.php we would use:

<?php include 'formboss/output/forms/php_include/page2.php'; ?>

With that done, back in FormBoss we would set our PHP Export Path to:

formboss/output/forms/php_include/

As you can see, the include code we use and the export path are almost identical.

Notice the inclusion of a trailing slash at the end of the PHP Export Path!

This should make sense to you, the PHP Export Path is simply where /public_html/page1.php can find the FormBoss form page. Of course their are many things going on behind the scenes to make this work, but you do not need to worry about them!

If you run into problems with the PHP Export Path, such as when you submit a page the form confirmation page doesn't work, you will find the following line of code in all form pages:

echo $_SESSION['MAX_PATH_PROC']; // Uncomment to see which path FormBoss is using to process pages

It is commented out by default, but you could uncomment the code to see which path FormBoss is trying to use.

One final note, when you set a PHP Export Path, you will notice the form no longer builds correctly in preview mode, nor will the submit buttons work. Thus it is advisable to hold off on setting the PHP Export Path until the very end.

As stated earlier, it is strongly preferred to just use the iFrame include, but this is available to you if needed.

Dependencies: A saved job.

Hints & Tricks: None at the moment.

Options/Properties


No options or properties

top