Print This Page


4. Hello World for ACP


Creating the "Hello World" for the ACP (administration contol panel) is not so different than for UI.

But you may want to verify if the user is really an admin, and not a regular user.

Hello World for ACP

  1. With a text editor, create a blank file in qE /admin folder, eg: test.php, place it in the same folder as index.php.
  2. Then add some PHP lines:
    // always use admin_init.php for ACP

    require './includes/admin_init.php';

    // verify if administrator? 1 - lowest level of admin, 5 - highest level

    admin_check (1);

    // as qE is template based, all output must be contained in $txt['main_body']

    $txt['main_body'] = 'Hello World';

    // send the content of $txt[main_body] to output
    // always remember, flush_tpl() also exit the script, so always put flush_tpl
    // at the end of the script!

    flush_tpl ('adm');
  3. Try it. It should print "Hello World" using your ACP skin. Easy eh? If you haven't login as admin, you will be asked to login first.

There is no comment. Why not be the first?

More Comments/Post Your Own

Powered by qEngine
Generated in 0.016 second | 15 queries