+1-209-266-2427, +91-981-872-0510

Create your own module in phpfox

3 users rated this post

You create a new module when you want to add a feature to your site, for example if you want to have a block displaying the latest or top rated musicians you would do this with a block and this block needs to belong to a module, since you made that block why not use your own module? 

When creating a module you need a folder in the /module/ folder, lets suppose the new module is named: newModule. The structure would look like this:

  1. /module/
  2. /module/newModule/
  3. /module/newModule/include/
  4. /module/newModule/include/component/
  5. /module/newModule/include/component/ajax/
  6. /module/newModule/include/component/block/
  7. /module/newModule/include/component/controller/
  8. /module/newModule/include/service/
  9. /module/newModule/static/
  10. /module/newModule/static/css/
  11. /module/newModule/static/jscript/
  12. /module/newModule/template/

For creating a new module you have to create a product (from the administration Control Panel, Extensions->Module-> Create Module.

After this you need to browse the directory where, you have installed the phpfox. Create a directory in module with your “newModule”, this will be your module. Now you need to follow the same folder structure as mentioned above. I will explain below what each folder holds.

Controllers are PHP classes that control all the pages on phpFox. It is the first PHP class we connect to in order to control the page we are viewing. The controller then decides how the page should behave and what sort of information we should display. To start things off we will create a small “Hello World!” page.

First, lets create the PHP class file for our controller. To do that create the following file:


In that file add the following PHP code:

class Newmodule_Component_Controller_Index extends Phpfox_Component {
public function process() {

In that file add the following PHP code:

class Newmodule_Service_Browse extends Phpfox_Service {
public function process() {

In that file add the following PHP code:

<?phpclass Newmodule_Service_Process extends Phpfox_Service {
public function process() {

Now lets create the HTML file for our controller, which will hold all the HTML. To do that create the file:


In that file add:

Hello World!

Your first page is about ready. You need to visit the URL as:


Congratulations! You have created your first controller.

Share this post
FacebookTwitterGoogle PlusLinkedinPrintEmail
Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular