Community Documentation

v3 Knowledgebase

Add a Page That Can Have Its Own Blocks (Beginner Level)

In order to create a page on which you can manage blocks, you will need to create some folders, files, module (if you didn't make one before for this) and a component. Wherever it says, "mypagename" replace that with the name of the page you are making. Wherever it says, "mypages", replace that with the name of the module you made or are making. This tutorial is a modified version of the other one found in the phpFox knowledgebase. We are going to do this step by step because we are keeping it separate from the core files, in its very own module.

Step 1

Create the folders (This only needs to be done once. If you've already created these folders before, disregard this step)



Step 2

In /module/mypages/include/component/controller/ , create the file mypagename.class.php and enter the following code:


defined('PHPFOX') or exit('NO DICE!');

class Mypages_Component_Controller_mypagename extends Phpfox_Component
* Class process method which is used to execute this component.
public function process()


Step 3

In /module/mypages/template/default/controller/, create the file mypagename.html.php and leave blank if you want to add blocks or enter your html.

Step 4

Create a Module (This only needs to be done once so if you've already created the module for new pages, disregard this step)

AdminCP--Extensions--Module--Create New Module


Create a Component (Note that the Component name must be lowercase with no spaces)

AdminCP--Extensions--Module--Add Component


Step 6

Add a Menu

AdminCP--CMS--Menus--Add New Menu

If you added html to your page when you created mypage.html.php file then you are done. Clear your Cache in the AdminCP and you should now see your page when you click on the menu. If you did not add html and want to add blocks, you will not find your page in the Controllers in Manage Blocks yet because you have to add blocks to it first. You will also have a page not found error or a white page if you have not added either html or blocks.

Add a block to your page:

If you want to move an existing block to your new page, find the page it is on listed in the controllers (AdminCP--CMS--Blocks--Manage Blocks) and click that page. To the right you will see the blocks listed. When you find the one you want to move, click the arrow to the left of it and click "edit". On the page that comes up, you want to change the "controller" to your new page and submit.