Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[ACP] The Page System
#1
1337 - version of the documentation. Self explanatory.

This will add a page called "example" in your ACP. Do it in a DEV installation. Please.
Code:
INSERT INTO `thtdev`.`tht_acpnav` (
`id` ,
`visual` ,
`icon` ,
`link`
)
VALUES (
'23', 'Example Page', 'page.png', 'example'
);
Run that query in SQL, remember to change "tht_acpnav" with the correct prefix, if your prefix is lol it would be "lol_acpnav".

Now add a file in /admin/pages/ called example.php
PHP Code:
<?

//////////////////////////////

// The Hosting Tool

// Admin Area - Example Page

// By Jimmie Lin

// Released under the GNU-GPL

//////////////////////////////



//Check if called by script

if(THT != 1){die();}



//Starts the Page Class

class page {

                 

    public $navtitle;

    public $navlist = array();

    

    public function __construct() {

        $this->navtitle = "Example Sub Menu";

        $this->navlist[] = array("Example Sub Page", "application_osx_terminal.png", "example");

    }



    public function description() {

        return "<strong>Example Description Title</strong><br />

        Welcome to the example description. Lorem Ipsum...";    

    }

    

    public function example(){

        echo "Example page content. Hello World!";

    }

    

    public function lol(){

        echo "LOL";

    }

    

    public function content() { # Displays the page 

        global $main;

        global $page;

        global $style;

        

        switch($main->getvar['sub']) {

           default: $this->lol(); break;

           case 'example': $this->example(); break;

        }

    }

}

?>

Self explanatory. This is an unofficial guide. If you know how to mess up with PHP, you should understand this. Wink
Jimmie Lin - Community Manager & THT.Next Developer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)