ft_display_module_page

This is the main work-horse function used to you display a web page for your module. It works by letting you define the location of a Smarty template with which to render the page, and the content to pass to the page. There is no limit to either the type or volume of information passed to the template, but a general rule of thumb is KISS (Keep It Simple, Stupid): don't pass along too much info and keep that info in simple data structures that easy to process by the template.

ft_display_module_page("templates/index.tpl", $info);

N.B. it also takes a third optional hidden $theme parameter to let you control the theme with which the page is rendered - but generally this isn't used, so unless you have something sneaky in mind, try to forget about it. Nothing to see here, move along... move along...

The path of the smarty template is always relative to your module folder. So in the example above, it's locating the file in a /templates subfolder.

In addition to the custom values passed to the page, the ft_display_module_page also populates a number of other variables at your disposal in the Smarty templates:

  • {$L} - the contents of your language file, containing the language of the administrator's choice (if it exists: otherwise it defaults to the language file that the module was written in)
  • {$LANG} - the contents of the main Form Tools language file, again in the admin's language
  • {$SESSION} - the entire contents of the Form Tools sessions (aspects of this are included in separate vars below)
  • {$settings} - the core Form Tools settings
  • {$account} - the logged in user account information
  • {$g_root_dir} - from config.php
  • {$g_root_url} - from config.php
  • {$same_page} - the URL of the current page. Handy when posting a form to itself
  • {$query_string} - the query string of the current page (not guaranteed to be populated on all servers)
  • {$dir} - the text direction (RTL / LTR)
  • {$g_success} - populated by every core function after performing a task (like updating / adding DB records). This is a boolean that logs whether the last task was a success or not
  • {$g_message} - the error / success message of the last performed task
  • {$module_nav} - the navigation menu contents for your module
  • {$images_url} - the URL to the current theme's images folder (required to be /images subfolder in theme)
  • {$themes_url} - the URL to the current theme folder
Edit Page