Hi Experts,
I would recommend the experts to upgrade the documentation to the level that makes some sense to the experienced developers but new commers to silverstripe. I found the silverstripe to learn hard due to its unstructured documentation.
I am stuck it on a very simple issue and didn't find any article in the documentation.
Problem:
I created a new controller in the mysite\code\controllers\Gallery.php
I created the following actions i.e.
<?php
class GalleryController extends Controller {
private static $allowed_actions = array(
'index',
'createimage',
'editimage',
'deleteimage',
);
public function index(SS_HTTPRequest $request)
{
$res = "here in the index action of gallery controller <br />";
echo $res;
return $this->getResponse();
}
public function createimage(SS_HTTPRequest $request){
$res = "here in the create action of gallery controller <br />";
echo $res;
return $this->getResponse();
}
public function editimage(SS_HTTPRequest $request)
{
echo "her in the edit action of gallery controller with picture id = $id <br />";
return $this->getResponse();
}
public function deleteimage(SS_HTTPRequest $request)
{
echo "her in the delete action of gallery controller with picture id = $id <br />";
//return $this->getResponse();
}
}
I am successfully access the default index action but not the others and is receiving the following error i.e.
Accessing the url i.e. http://localhost:8011/ss_pac/gallery/createimage
Error: Action 'createimage' isn't available on this handler.
I am getting the same error with editimage, deleteimage actions as well.
I am following this page in the documentation i.e. https://docs.silverstripe.org/en/3.3/developer_guides/controllers/introduction/
Here is my routes file at mysite\_config\routes.yml
## YAML Template.
# ---
Name: mysiteroutes
After: framework/routes#coreroutes
# ---
Director:
rules:
'gallery//$Action/$Id': 'GalleryController'
Looking for someone who will tell me how to reach to the particular action. Looking forward.
Cheers,
Naveed.