To create a custom admin controller for your website, just add a new controller folder to your website's controller/admin folder (create the admin folder if it is not there already):

[path_to_site]/controller/admin/[controller_name].controller.class.php

It is recommended group your controllers into sub folders of admin, for example:

[path_to_site]/controller/admin/example/default.controller.class.php
[path_to_site]/controller/admin/example/[controller_name].controller.class.php

Your controller will extend InvController, and the basic structure will be:

<?php
	
class ExampleController extends InvController 
{
	public function __construct($obj_db , $obj_session , $view_template , $path_info){
		parent::__construct($obj_db , $obj_session , $view_template , $path_info);
		$this->view_title = 'Example';
	}
	
	protected function setInputValues() 
	{
		// Set any GET / POST inputs required by your controller, for example
		$this->setInputValue('example1');
		$this->setInputValue('example2');
	}
	
	public function doController() 
	{
		// Process user input, and generate output, for example...
		$this->message = 'Received: ' . $this->arr_input['example1'] . ' and ' . $this->arr_input['example2'];
	}
	
}

?>

Theme template

You should also add a theme template for this controller in your current theme folder. If you're using a library theme theme, you can create a 'custom' folder within themes to contain your custom templates.

If you are using a custom theme for your website

[path_to_site]/theme/[theme_name]/admin/[controller_name].html

If you are using a library theme for your website

[path_to_site]/theme/custom/admin/[controller_name].html

Example template

<h1>Example Template</h1>
<p><?php echo htmlspecialchars($this->message) ?></p>

More information on the structure of dotAdmin controllers here

Contact Us

Address: 22a Fishergate York, YO10 4AB · Tel: 01904 636677 · Email: info@dotadmin.com