How To Create an Admin App

Admin apps are plug 'n play. An app is defined by a folder named .app for suffix e.g. admin/myapp.app/. Inside the folder you need to create a configuration file config.inc.php that defines the app and pages inside it. See below for an example.

admin/myapp.app/config.inc.php:


 return [
   'name' => 'My App',
   'default' => 'example', // The default page to display when opening the app
   'priority' => 0,
   'theme' => [
     'color' => '#999999',
     'icon' => 'fa-star', // Fonticon
   ],

 // Submenu items (optional)

   'menu' => [
     [
       'title' => 'Example page',
       'doc' => 'example',
     ],
     //...
   ],

 // Mapped docs to files

   'docs' => [
     'example' => 'example.inc.php',
   ],
 ];

General good practise is to stack the contents of your app like this.

<?php
  /* PHP Logic */
?>

<style>
  /* CSS Styling */
</style>

<div>
  <!-- HTML Content -->
</div>

<script>
  /* Javascript */
</script>

admin/myapp.app/example.inc.php:


<?php
    document::$title[] = language::translate('title_my_app', 'My App');
    breadcrumbs::add(language::translate('title_my_app', 'My App'));
?>
<div class="card">
  <div class="card-header">
    <div class="card-title">
      <?php echo $app_icon; ?> My App
    </div>
  </div>

  <div class="card-body">
    <p>Lorem ipsum dolor</p>
  </div>

  <div class="card-footer">
  </div>
</div>

Hard refresh the page to reload the list of apps. Ctrl + F5

See Also

Revisions

Recently Edited Articles