Create a Page

The latest documentation can be found on the Project Wiki. The information below may be out of date.
User-facing pages can be constructed easily using the FanniePage class (or one of its specialized subclasses). A basic page definition looks like this:
include_once(dirname(__FILE__).'/../../../config.php');
if (!class_exists('FanniePage')) include($FANNIE_ROOT.'classlib2.0/FanniePage.php');

class CalendarMainPage extends FanniePage {
}
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)){
	$obj = new CalendarMainPage();
	$obj->draw_page();
}

As in the plugin definition, the global configuration file and API class definition are included then a subclass is defined. In compliance with naming conventions this particular file should be named CalendarMainPage.php. The last lines will print the page but only if this file is called directly. Blocking off the draw_page() call with this if statement makes it safe for other developers to include() this file if they want to reuse or extends our class.

FanniePage is designed to let developers easily maintain consistent look and feel without repeating lots of code as well as tie into lots of different sections of the page. A subclass may override any of the following:

FanniePage also includes some helper methods. They are not meant to be overriden but can be useful in the above methods or any additional custom methods.

URL best practices: like filesystem paths, no assumptions should be made about where Fannie is installed. To get a URL to somewhere within your plugin, create an instance of your plugin definition class then call its plugin_url() method. This returns the URL of the directory containing your plugin. To reference a URL somewhere else in Fannie, use the global configuration variable $FANNIE_URL. It points to the directory containing Fannie.