Friendica uses Smarty 3 as PHP templating engine. The main templates are found in
theme authors may overwrite the default templates by putting a files with the same name into the
Templates that are only used by addons shall be placed in the
To render a template use the function getMarkupTemplate to load the template and replaceMacros to replace the macros/variables in the just loaded template file.
$tpl = Renderer::getMarkupTemplate('install_settings.tpl'); $o .= Renderer::replaceMacros($tpl, array( ... ));
the array consists of an association of an identifier and the value for that identifier, i.e.
'$title' => $install_title,
where the value may as well be an array by its own.
To guarantee a consistent look and feel for input forms, i.e. in the settings sections, there are templates for the basic form fields. They are initialized with an array of data, depending on the tyle of the field.
All of these take an array holding the values, e.g. for a one line text input field, which is required and should be used to type email addesses use something along the lines of:
'$adminmail' => array('adminmail', DI::l10n()->t('Site administrator email address'), $adminmail, DI::l10n()->t('Your account email address must match this in order to use the web admin panel.'), 'required', '', 'email'),
To evaluate the input value, you can then use the $_POST array, more precisely the $_POST['adminemail'] variable.
Listed below are the template file names, the general purpose of the template and their field parameters.
A checkbox. If the checkbox is checked its value is 1. Field parameter:
A combobox, combining a pull down selection and a textual input field. Field parameter:
A customizeable template to include a custom element in the form with the usual surroundings, Field parameter:
A single line input field for any type of input. Field parameter:
text(possible types: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#%3Cinput%3E_types).
A checkbox (see above) but you can define the value of it. Field parameter:
An input box (see above) but prepared for special CSS styling for openID input. Field parameter:
A single line input field (see above) for textual input. The characters typed in will not be shown by the browser. Field parameter:
A radio button. Field parameter:
A multi-line input field for rich textual content. Field parameter:
A drop down selection box. Field parameter:
A drop down selection box (see above) but you have to prepare the values yourself. Field parameter:
A multi-line input field for (plain) textual content. Field parameter: