diff --git a/_shared_assets/themes/owncloud/static/img/info.svg b/_shared_assets/themes/owncloud/static/img/info.svg deleted file mode 100644 index 1e07aed85..000000000 --- a/_shared_assets/themes/owncloud/static/img/info.svg +++ /dev/null @@ -1,1758 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/developer_manual/templates.rst b/developer_manual/templates.rst index 770396174..8caf55371 100644 --- a/developer_manual/templates.rst +++ b/developer_manual/templates.rst @@ -1,12 +1,17 @@ Templates ========= -ownCloud uses its own templating system. The templating system basically works by defining main template files. Those template files then include their own templates. +.. sectionauthor:: Bernhard Posselt -.. note:: - Templates must not contain database queries! All data should be passed to the template via $template->assign($key, $value). +.. warning:: + To prevent XSS the following PHP **functions for printing are forbidden: echo, print() and assign($key, $value)``. + + +ownCloud uses its own templating system. Templates reside in the ``template/`` folder. To use them you'll need to instantiate the ``OC_Template`` class with the name of the template. If you want to pass values to it, use the ``assign`` method. -It's actually pretty simple. For instance take a look at this example: **index.php** @@ -14,27 +19,28 @@ It's actually pretty simple. For instance take a look at this example: assign('entries', $allEntries); $mainTemplate->assign('name', "john doe"); $mainTemplate->printPage(); ?> +To access the assigned variables in the template, use the $_[] array. The variable will be availabe under the key that you defined (e.g. $_['key']). -**templates/main.inc.php** +**templates/main.php** .. code-block:: php - +

inc('sub.inc'); + + print_unescaped($this->inc('sub.inc')); + ?> +Templates can also include other templates by using the $this->inc('templateName') method. Use this if you find yourself repeating a lot of the same HTML constructs. The parent variables will also be available in the included templates, but should you require it, you can also pass new variables to it by using the second optional parameter for $this->inc. **templates/sub.inc.php** @@ -64,7 +70,7 @@ Template class .. code-block:: php @@ -81,7 +87,7 @@ Template class .. code-block:: php addHeader('title', array(), 'My new Page'); ?> @@ -100,7 +106,7 @@ Template class assign('customers', $customers); $mainTemplate->append('customers', 'hanna'); ?> @@ -122,7 +128,7 @@ Template class assign('customers', $customers); ?> @@ -136,7 +142,7 @@ Template class .. code-block:: php detectFormfactor(); ?> @@ -166,7 +172,7 @@ Template class .. code-block:: php detectFormfactorExtension(); ?> @@ -177,7 +183,7 @@ Template class :param array $additionalparams: an array with additional variables which should be used for the included template :returns: returns content of included template as a string - Includes another template. use inc('template'); ?> to do this. The included template has access to all parent template variables! + Includes another template. use inc('template')); ?> to do this. The included template has access to all parent template variables! **Example:** @@ -199,7 +205,7 @@ Template class .. code-block:: php assign('test', array("test", "test2")); $mainTemplate->printPage(); ?>