Tips for Programmers

FlightPath tries to be as developer-friendly as possible, and comes with several tools built in for your convenience.

 

Executing PHP Code

Sometimes if you need to test something out, it's easier to just execute a few lines of PHP on the fly, rather than create a whole module file, enable it, create a menu item, etc, just to get back some results.

For this reason, FlightPath has an "Execute PHP" page built in to the Admin Console.  By default, it is only accessible to the admin user:

From that page, you can enter any arbitrary PHP code you want to execute.  Obviously, this is a very powerful feature-- only use it if you know what you are doing.

 

Better Debug Output

One of the most useful features during module development is FlightPath's built-in debug output function, called "fpm()" (modeled after Drupal's dpm() function in the Devel module).

With fpm(), you can output basic text statements to the screen like so:  fpm("The value of x is " . $x);

Or, if you give fpm() an array or object, you get a much more interesting display.

For example:  fpm($some_array_or_object);

It actually creates a clickable, collapsible display of the various values in the array.  Notice that you can have nested arrays, objects, etc.  Each one gets a new clickable line, for you to explore the keys and values inside.