Yeah, you need to create the routes array ofc, its not there from the beginning. Using the route name is âcleanerâ since things donât break if your URLs break.
JavaScript makes sense, but not everywhere. JavaScript for navigation is a no-go. Basic functionality should not depend on JavaScript, IMHO.
While this is probably true for websites Iâd challenge that for your current usecase.
What I need is a full-URL including at least path prefix, or anything else that might be necessary, so I need something like: https://my.domain.com/path/to/my/nextcloud/installation/index.php/appname/âŠ
As mentioned before inject IURLGenerator then do something like that:
public function __construct(/* more stuff before here */ OCP\IURLGenerator $urlGenerator) {
$this->urlGenerator = $urlGenerator;
}
/* in the controller method */
return new TemplateResponse($this->app, 'template_name', ['routes' => [
$this->app . '.page.index' => $this->urlGenerator->linkToRoute($this->app . '.page.index')
]]);
I wrote this from memory so you might run into syntax errors but it should demonstrate the usage
@BernhardPosselt, thatâs still not the full answer. Where do I get the OCP\IURLGenerator from? Thatâs an abstract base class and simply adding an argument to the controllerâs construtor leads to a crash in Application.php, where it is instanciated:
Nachricht: Argument 6 passed to OCA\GgrWinti\Controller\GeschaeftController::__construct() must implement interface OCP\IURLGenerator, none given, called in /var/www/nextcloud/apps/ggrwinti/lib/AppInfo/Application.php on line 64
I opened it yesterday, 20:10 oâclock, now itâs 10:05. In these 14 hours, there was not a single message execpt two «hi» and what I wrote. Only tons of enter/quits.