I’m a totally beginner in programming apps for Nextcloud (not programming as such).
For this I tried starting with the tutorials provided here: https://nextcloud.com/de/developer/.
But starting with the first “HelloWorld” tutorial I run into problems:
on creating an app skelleton here I could not find the posibility to chose the Nextcloud version
after downloading and extracting skeleton I could not find all the directories and files like described in the turorial
My question is: Is the tutorial or the skeleton generator outdated or do I something wrong?
Whe I put the extracted skeleton to my apps directory and enable the app it works like described: I get a empty page.
But I can’t go further in the tutorial cause some files are missing in the skeleton, e.g. the routes.php.
Can someone please help?
Thanks @christianlupus!
Seems that was the kick I needed. After some more searching I found here the developer manual to understand the secrets behind the app development and from there also the link to the PHP-API, so that I can go ahead .
Since I’m a software developer (OK - currently and since the last 20 years “only” for C# an WPF, but now I will dive into PHP, JS, HTML an Vue) I’m confident that my project will become successful.
If I have detailed problems, i will come back to this forum
Hey, if you’re still here, I was just able to fix the code to get the HelloWorld app running again. I will try to get the tutorial updated as soon as possible, but for now, here is the code that needs to be placed in ./lib/Controller/PageController.php:
<?php
declare(strict_types=1);
namespace OCA\HelloWorld\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
class PageController extends Controller
{
public function __construct($appName, IRequest $request)
{
parent::__construct($appName, $request);
}
#[NoCSRFRequired]
#[NoAdminRequired]
#[FrontpageRoute(verb: 'GET', url: '/')]
public function index(?string $getParameter): TemplateResponse
{
if ($getParameter === null) {
$getParameter = "";
}
// The TemplateResponse loads the 'index.php'
// defined in our app's 'templates' folder.
// We pass the $getParameter variable to the template
// so that the value is accessible in the template.
return new TemplateResponse(
'helloworld',
'index',
['myMessage' => $getParameter]
);
}
}
hi! I have made the adjustment of @edward in the original tutorial. I will soon schedule some time to also check the other tutorials. I have also removed the Nextcloud version note about the app skeleton generator.
I have not tested the turorial myself just now, but I will try to find some time later this week to test it.
I’m sorry, some refactoring was done and we forgot to update the tutorials. I will soon schedule time to check the other tutorials too. Thank you so much for reaching out!