diff --git a/developer_manual/templates.rst b/developer_manual/templates.rst index d97c9582c..7388211bc 100644 --- a/developer_manual/templates.rst +++ b/developer_manual/templates.rst @@ -6,6 +6,64 @@ ownCloud uses its own templating system. Template class -------------- +.. php:class:: OC_Template + + This class provides the templates for owncloud. It is used for loading template files, assign variables to it and render the whole template. + + .. php:method:: __construct($app, $name[, $renderas]) + + :param string $app: the name of the app + :param string $file: name of the template file (without suffix) + :param string $renderas: If $renderas is set, OC_Template will try to produce a full page in the according layout. For now, renderas can be set to "guest", "user" or "admin" + :returns: OC_Template object + + + .. php:method:: detectFormfactor() + + :returns: The mode of the client as a string. **default** -> the normal desktop browser interface, **mobile** -> interface for smartphones, **tablet** -> interface for tablets, **standalone** -> the default interface but without header, footer and sidebar, just the application. Useful to use just a specific app on the desktop in a standalone window. + + .. php:method:: getFormFactorExtension() + + :returns: Returns the formfactor extension for current formfactor (like .mobile or .tablet) + + .. php:method:: assign($key, $value[, $sanitizeHTML=true]) + + :param string $key: the key under which the variable can be accessed in the template + :param $value: the value that we want to pass + :param bool $sanitizeHTML: false, if data shouldn't get passed through htmlentities + :returns: bool + + This function assigns a variable. It can be accessed via $_[$key] in the template. If the key existed before, it will be overwritten + + + .. php:method:: getFormFactorExtension() + + :returns: Returns the formfactor extension for current formfactor (like .mobile or .tablet) + + .. php:method:: append($key, $value) + + :param string $key: the key under which the variable can be accessed in the template + :param $value: the value that we want to pass + :returns: bool + + This function assigns a variable in an array context. If the key already exists, the value will be appended. It can be accessed via $_[$key][$position] in the template. + + .. php:method:: addHeader($tag, $attributes[, $text='']) + + :param string $tag: tag name of the element + :param array $attributes: array of attrobutes for the element + :param string $text: the text content for the element + + Add a custom element to the html
+ + + .. php:method:: printPage() + + :returns: bool + + This function proceeds the template and prints its output. + + Template syntax --------------- @@ -25,7 +83,7 @@ This is the print statement which prints out XSS escaped values. ownCloud does n