Basic new app for Nextcloud

Hello,

I am a beginner with php, and i want to create a very basic app where to start from scratch. I am currently at the “hello world” app example but i cannot go further. I am trying to use the php library called jpGraph, i have created in the lib folder first_graph.php file with the sample code provided by jpGraph for creating a bar graph referencing two more php files needed from this library (require_once (‘jpgraph.php’); require_once (‘jpgraph_bar.php’); in the code) that i have copied also in the lib folder.

After this, i just add bellow the h1 Hello World line in templates/content/index.php another line as stated in the jpGraph documentation but when i access to my app i just receive the hello world line as expected and bellow a broken source icon coming from this line.

Could some body help me to get this first jump?

Thanks

Nobody? is this the right place to ask for some help?

Ask in #nextcloud-dev on irc.freenode.net and be patient :wink:

Hello,
do you mean you created a file like this?
http://jpgraph.net/features/src/show-example.php?target=new_line1.php

and you try to include this in index.php via a require?

I am not sure if this is the way to go.

  1. put your 2 new files not into lib/ but into a 3rdparty/jpGraph in your app root. the controller in lib/ are only yours
  2. in your index.php try to include them via require_once __DIR__.'/../../3rdparty/jpGraph/jpgraph.php';
  3. then put all the code from the demo page into the index.php itself and see if this works.
  4. if it works, you have your fist basis to start off
  5. next step would be to get your data e.g. from a database via a /lib/controller/ and include them dynamically in your page. but first things first

Thanks Rello! That was exactly the kind of help i was looking for!!

I followed exactly your stepts ( the only difference from my original one was the folder location and the DIR on the require) but i am still getting the same result, it seems like if it looses all the css and i get just the index.pho from navigation and settings folder with no css format, so i couldnt get this base where to start off…

Any other idea??

Thanks!!

I guess you don´t have it on github yet?

Thanks Bernahard, i will try this option too.

Already there :wink:

t

By the way, tried accesing resources throught template/content/index.php echo and it didnt work for me, even trying to access img files.
(its updated on github too).

<?php
echo '
<h1>Holaaa </h1>
<img src="/img/newplot.png">
<img src="/lib/linear_plot.php" alt="" border="0">
';
?>

Any idea?

Thaaannks