Hello everyone !
My aim is to create fully custom controller and view select custom report data and display with same menu and layout as original website.
I'm trying to create a custom controller in EspoCRM, and I'm facing some challenges.
I'd appreciate any guidance or advice on the process.
Step 1 - Controller
I created controller in various locations
Case 1) /var/www/espocrm/custom/CustomController.php
Case 2) /var/www/espocrm/custom/Espo/Custom/CustomController.php
Case 3) /var/www/espocrm/custom/Espo/Custom/Controllers/CustomController.php
Controller content is:
Step2 - added to nginx conf
As a result - i was unable to see any content under this links
/index.php/Custom/index
/index.php/Custom/Custom/index
/#Custom/index
/#Custom/Custom/index
it was or 404 not found or black page or blank layout
PS: caches where cleared after each modifications
My aim is to create fully custom controller and view select custom report data and display with same menu and layout as original website.
I'm trying to create a custom controller in EspoCRM, and I'm facing some challenges.
I'd appreciate any guidance or advice on the process.
Step 1 - Controller
I created controller in various locations
Case 1) /var/www/espocrm/custom/CustomController.php
Case 2) /var/www/espocrm/custom/Espo/Custom/CustomController.php
Case 3) /var/www/espocrm/custom/Espo/Custom/Controllers/CustomController.php
Controller content is:
Code:
<?php namespace Espo\Custom\Controllers; use Espo\Core\Utils\QueryBuilder; class CustomController extends \Espo\Core\Controllers\Base { public function indexAction() { $this->checkPermission('read'); $queryBuilder = new QueryBuilder(); $queryBuilder->select(['id', 'name', 'custom_field']) ->from('YourEntityName') // Replace 'YourEntityName' with the actual entity name you want to query ->where(['some_condition' => 'some_value']); // Add conditions as needed $records = $this->getEntityManager()->getEntityCollection($queryBuilder); $this->view->set('records', $records); $this->view->render('custom/Views/Custom/custom-view.php'); } }
Code:
location / { try_files $uri $uri/ /index.php?$query_string; }
/index.php/Custom/index
/index.php/Custom/Custom/index
/#Custom/index
/#Custom/Custom/index
it was or 404 not found or black page or blank layout
PS: caches where cleared after each modifications
Comment