[owncloud-devel] owncloud app navigation from sidebar

Bernhard Posselt dev at bernhard-posselt.com
Thu Apr 2 07:25:17 GMT 2015


Take a look at the app tutorial in the docs
https://doc.owncloud.org/server/8.0/developer_manual/app/tutorial.html#creating-a-navigation

If you are looking for a more sophisticated solution, take a look at the
ownCloud notes app https://github.com/owncloud/notes which uses angular
to do the routing like described here
https://egghead.io/lessons/angularjs-ng-view

How should the JavaScript work? You want a dynamic navigation so it has
to be rendered with JavaScript. The tutorial uses a template engine for
this, namely handlebars
(https://doc.owncloud.org/server/8.0/developer_manual/app/tutorial.html#creating-a-navigation).


First you get the the template's content
https://github.com/owncloud/app-tutorial/blob/master/js/script.js#L138
and then compile it. Then you pass the parameters to the template and
attach it to the dom
(https://github.com/owncloud/app-tutorial/blob/master/js/script.js#L142), wire
up the eventhandlers if needed etc. The event handlers load JSON from
your php app and rerender the navigation.

More on handlebars can be read here:
http://tutorialzine.com/2015/01/learn-handlebars-in-10-minutes/

This is all very basic JavaScript, you can use any js template engine or
even only jQuery (produces a total mess though). The only thing that you
need to keep in mind is that your PHP controllers return JSON and that
you want to update the HTML based on the JSON that was returned. How you
do that is up to you, the tutorial uses the most minimalistic best
practice approach.


On 04/02/2015 07:26 AM, abhiawanti wrote:
> I am newbie to the owncloud app development. I am trying to do a simple app
> in the owncloud environment. In my app I created the basic things like
> appinfo file and index.php file and enabled the app also. So now I want to
> implement the navigation from sidebar and the page should not reload (like
> in file or activity app)I am using the owncloud API's only. Now I stuck
> there only. I cant able to navigate the pages without refreshing. I am
> trying to understand the javascript files but I am not geeting anything in
> tat. For this please suggest me what all things I should do and learn? And
> how it can be implement.
>
> P.S: I read owncloud official document (developer manual) but that has not
> helped me..
>
> Any help that will be appreciated. Thanks in advance
>
>
>
> --
> View this message in context: http://owncloud.10557.n7.nabble.com/owncloud-app-navigation-from-sidebar-tp14868.html
> Sent from the Developers mailing list archive at Nabble.com.
> _______________________________________________
> Devel mailing list
> Devel at owncloud.org
> http://mailman.owncloud.org/mailman/listinfo/devel



More information about the Devel mailing list