Thanks to @cyandark and @timnboys I've got the Alpha 2 in dev: https://screencast.com/t/vdQEiwbfUe
Just have an issue with my index but that's down to routes. the dropdown for Categories still haven't been sorted so they show the text I've set at the moment will be working on it when I'm back from work tonight.
okay great, would be looking forward to beta test or get the plugin on release because I would like to pair blestacms and blestaforums together and move back from modx lol
Thank you guys I've finally got where I want almost just need to fix that routes as it's working at the moment via forum/index/1/ but not /forum/1/ so I need to use the client_loc and plugins and then the folder name I think
Yes, but will be accessible from /forum/index/1/
If you want to delete the index part of the url you will need to make a route like this
Router::route("^forum/(.+)", "/my_plugin/forum/index/$1");
You can take as an example the main controller of a previous version of BlestaCMS. It works in a similar way.
that is sounding like you are looking for a way to rewrite the url so for example if announcements is forum id one it shows as {blestaroot}/plugin/blestaforums/forum/1/ correct? if so that sounds like some sort of route or rewrite you would have to tell blesta about.
I would recommend in your forum controller php file mike to put what cyandark showed in your index function as such:
class Forum extends MyPluginController {
.....
public function index() {
if (!empty($this->get[0]) && is_numeric($this->get[0])) {
$page_id = $this->get[0];
} else {
$page_id = 1;
}
// Load forum model
Loader::loadModels($this, ['MyPlugin.ForumsFunctions']);
// Get forum page
$forum = $this->ForumsFunctions->getForum($page_id);
}
....
}
put the above in your index function for your forum controller and yes it will show up with the structure you want in the url.
eg this structure:
http://awesomecompany.com/client/plugin/my_plugin/forum/1/
that would get the forum id 1 as shown in the example url like you want.
do note the .... is to be your existing code don't copy the .'s please they have no real purpose other than being a placeholder for your other code.
Assuming you have a controller named "Forum" and a "page" function.
http://awesomecompany.com/client/plugin/my_plugin/forum/page/1/
class Forum extends MyPluginController {
public function index() {
// Main view
}
public function page() {
if (!empty($this->get[0]) && is_numeric($this->get[0])) {
$page_id = $this->get[0];
} else {
$page_id = 1;
}
// Load forum model
Loader::loadModels($this, ['MyPlugin.ForumsFunctions']);
// Get forum page
$forum = $this->ForumsFunctions->getForum($page_id);
}
}
that sounds like what I did similar to that in my vultr module to grab the saved plan from the db to be selected by default in the dropdown select box on editing a package
I would "fish" the code out I used to do that but I don't think it is relevant to what mike is trying to do since he wants to do exactly as you described @cyandark because mine was for a module this is probably in relation to mike's blestaforums plugin.
I guess that $this->get can do the job.
For example, for http://awesomecompany.com/client/plugin/my_plugin/page/12/ $page will be 12
if (!empty($this->get[0]) && is_numeric($this->get[0])) {
$page = $this->get[0];
} else {
$page = 1;
}
Then you can get the page from your model
Loader::loadModels($this, ['MyPlugin.MyModel']);
$page = $this->MyModel->getPage($page);
Hi NETLINK,
The payment_id parameter allows the api request to charge a credit card stored on namesilo instead of prepaid funds. Hopefully I used the correct words to describe it. What I want to achieve is when the order for domain register/transfer is placed through the order form in Blesta, then Namesilo should charge my stored credit card instead of trying to use prepaid funds.