This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I build a backend plugin to control my database. This will not be a public plugin.
The default path of controllers and action is this
backend/[author name]/[plugin name]/[controller name]/[action name]
But how can I create my own path like "backend/[plugin name]/[controller name]/[action name]" or backend/sublevel1/sublevel2 etc.
Or anything like this, is this possible?
Also how I can set a default action on controller.
I mean this url "backend/[plugin name]/[controller name]" to load "backend/[plugin name]/[controller name]/[action name]"
You could RTFM, but if you are as lazy as me, you don't really have time for that ;-)
It is is very easy to do:
<?php namespace YourGroup\NameSpace\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class CustomController extends Controller
{
public function __construct()
{ //magical goodness here
}
// Create a View partial in your in the corrorsponding folder of the same name as your controller
// Partial name will the same name as your "action" ex: yourcustomcontrolleraction.htm
public function yourCustomControllerAction(){
$arrayOfURIParams = $this->params; //Your other parameters in the URI
}
If you want to set the default action of the controller, create a method as follows(and create your index.htm partial in the controller folder:
public function index(){ //amazing code here
}
Hope this helps: BTW here is the manual https://octobercms.com/docs/backend/controllers-ajax
Last updated
1-2 of 2