Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can define menu menus in adminCP AdminCP in file Install.php

Code Block
languagephp
php
linenumberstrue

protected function setOthers()
{
    $this->admincp_menu = [
        "'Manage Campaigns"To Do' => "betterads"'todo', // 'todo' is app's alias
   "Add Placement" => "betterads.addplacement",
        "Manage Placements" => "betterads.placement",
        "Manage Invoice" => "betterads.invoice",
        "Manage Sponsorships" => "betterads.sponsor",
    ];//Do not put admincp here
    $this->admincp_route = 'admincp.betterads';//must be begun with admincp
}

 

 

];

    $this->admincp_route = 'admincp.todo'; // 'todo' is app's alias
}

After that, on start.php, we add below lines.

Code Block
php
php

// 'todo' is app's alias
$module->addComponentNames('controller', [
    'todo.admincp.index' => Controller\AdminManageTodoController::class
]);

group('todo/admincp', function () {
    route('/', 'todo.admincp.index');
});

Finally, we add controller file and view file.

Path of controller file:

  • Apps/TodoList/Controller/AdminManageTodoController.php

Path of view file:

  • Apps/TodoList/views/controller/admincp/index.html.php

Sample structure of a controller file

Code Block
php
php

<?php
namespace Apps\TodoList\Controller;

use Phpfox_Plugin;

defined('PHPFOX') or exit('NO DICE!');

class AdminManageTodoController extends \Phpfox_Component
{
    public function process()
    {
        //Put your code here
    }

    public function clean()
    {
        (($sPlugin = Phpfox_Plugin::get('todo.component_controller_admincp_manage_clean')) ? eval($sPlugin) : false);
    }
}