База на знаења

How to build a CWP Module Print

  • 0

How to build a CWP Module

How to Build a new module for CentOS Web Panel (CWP)?

It’s very easy to build a new module for the CentOS-WebPanel
Let’s create file named: test2.php



<?php $cpu_info = shell_exec("cat /proc/cpuinfo"); echo "This is example module<br>"; echo "You can edit this file and make new modules based on this file<br>"; echo "Examples and functions are on our website: centos-webpanel.com<br>"; echo "<h3>CPU INFO</h3>"; echo "<pre>".$cpu_info."</pre>"; ?>

to open this file in CentOS-WebPanel, upload it to the modules folder and use this link path:
https://SERVER_IP:2030/index.php?module=FILE_NAME

eg. https://123.123.123.123:2030/index.php?module=test2

How to add this module into the CentOS-WebPanel menu?

It’s easy, go to include folder and make a new file named 3rdparty.php, in this file you can add links (one per a line).
eg.

cwp.admin: /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php
cwp.client: /usr/local/cwpsrv/htdocs/resources/client/include/3rdparty.php

<li><a href="index.php?module=test2"><span class="icon16 icomoon-icon-arrow-right-3"></span>Test2 Module</a></li>
<li><a href="index.php?module=test3"><span class="icon16 icomoon-icon-arrow-right-3"></span>Test3 Module</a></li>


All useful modules will be added in CWP installation

Admin panel modules location
/usr/local/cwpsrv/htdocs/resources/admin/modules

Client panel modules location
/usr/local/cwpsrv/htdocs/resources/client/modules

Example module developed by the 3rdParty

https://github.com/boxbillinggit/cwp_modules/blob/master/php_phalcon.php


Дали Ви помогна овој одговор?
Back