mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-02 17:59:36 +07:00
Merge pull request #555 from owncloud/template-functions
Template functions
This commit is contained in:
@@ -9,8 +9,26 @@ The CSS files reside in the **css/** folder and should be included in the templa
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
\OCP\Util::addStyle('myapp', 'style'); // adds js/style.css
|
||||
// include one file
|
||||
style('myapp', 'style'); // adds js/style.css
|
||||
|
||||
// include multiple files for the same app
|
||||
style('myapp', array('style', 'navigation')); // adds js/style.css, js/navigation.css
|
||||
|
||||
Web Components go into the **component/** folder and can be imported like this:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
// include one file
|
||||
component('myapp', 'tabs'); // adds component/tabs.html
|
||||
|
||||
// include multiple files for the same app
|
||||
component('myapp', array('tabs', 'forms')); // adds component/tabs.html, component/forms.html
|
||||
|
||||
|
||||
.. note:: Keep in mind that Web Components are still very new and you `might need to add polyfills using Polymer <http://www.polymer-project.org/resources/compatibility.html>`_
|
||||
|
||||
Standard layout
|
||||
===============
|
||||
To use the commonly used layout consisting of sidebar navigation and content the **app-navigation** and **app-content** ids can be used:
|
||||
|
||||
@@ -9,7 +9,11 @@ The JavaScript files reside in the **js/** folder and should be included in the
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
\OCP\Util::addScript('myapp', 'script'); // adds js/script.js
|
||||
// add one file
|
||||
script('myapp', 'script'); // adds js/script.js
|
||||
|
||||
// add multiple files in the same app
|
||||
script('myapp', array('script', 'navigation')); // adds js/script.js js/navigation.js
|
||||
|
||||
The recommended JavaScript framework to use is `AngularJS <https://angularjs.org/#>`_. A nice tutorial screencast collection can be found on `Egghead.io <https://egghead.io/technologies/angularjs>`_
|
||||
|
||||
@@ -38,4 +42,4 @@ Full URLs can be genrated by using:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
var authorUrl = OC.generateUrl('/apps/myapp/authors/1');
|
||||
var authorUrl = OC.generateUrl('/apps/myapp/authors/1');
|
||||
|
||||
Reference in New Issue
Block a user