In this exercise, you will construct a simple tabbed web interface
integrated into Plesk. The first tab will contain a form, the second
will contain a list of items, and the third - a toolbox with two
actions. The exercise demonstrates the basics of building into the Plesk
GUI.
We assume that the extension ID is example
, and that you start with
the code inside the ex1
directory. This code is partly written by us
to help you focus only on certain areas. Additionally, we have populated
the directory with media content necessary for the exercise. To see the
completed exercise, examine the ex1complete
directory.
Also, it is recommended to adjust your development
environment to easily check the results of your work.
Step 1. Obtain the control flow from Plesk
Each extension has a single index file that is executed first when a
user navigates to the extension from Plesk (for example, when the
administrator goes to Server Management > Extensions and clicks
the extension name). This index file is called index.php
and its
path is /htdocs/index.php
relatively to the extension’s root
directory. From this start point, you can either write your own code
which renders the GUI in its own way, or use facilities for rapid
extensions development that the SDK provides.
One of these facilities is support for the MVC pattern. If you are
unfamiliar with the pattern, please read
http://framework.zend.com/manual/1.11/en/learning.quickstart.intro.html.
Applied to our example, the first thing we need to do is to select an
appropriate class for further processing of the request to the
index.php
. Edit the file so that it looks as follows
(https://github.com/plesk/pm-exercises/blob/master/ex1/htdocs/index.php):
<?php
pm_Context::init('example');
$application = new pm_Application<span…