Including in Packages

If you haven't, check out the documentation on packaging a theme. Here you'll learn the ins and outs on the Concrete CMS package format, a package's Controller file, and get up to speed quickly.

Once you have your package's Controller file created, it's a simple matter to add support for your custom single page and its controller to the package. For this example, we'll assume we're creating a single page at /dashboard/system/game/.

Create a single_pages and controllers directories within your package's directory.

mkdir packages/game_system
mkdir packages/game_system/single_pages
mkdir packages/game_system/single_pages/dashboard
mkdir packages/game_system/single_pages/dashboard/system
mkdir packages/game_system/controllers
mkdir packages/game_system/controllers/single_page
mkdir packages/game_system/controllers/single_page/dashboard
mkdir packages/game_system/controllers/single_page/dashboard/system

Create a package controller file as per the theming instructions listed above, at packages/game_system/controller.php.

Place the HTML and view logic for your single page at packages/game_system/single_pages/dashboard/system/game.php (note the use of single_pages plural).

Create the controller at packages/game_system/controllers/single_page/dashboard/system/game.php (note the use of single_page singular). Make sure it has the proper namespace (NOT beginning with Application).

<?
namespace Concrete\Package\GameSystem\Controller\SinglePage\Dashboard\System;
use \Concrete\Core\Page\Controller\DashboardPageController;

class Game extends DashboardPageController
{

}

Add a reference to the \Concrete\Core\Page\Single class to the top of your package controller.

use \Concrete\Core\Page\Single as SinglePage;

In your package's install() method, install your single page using the Concrete\Core\Page\Single::add() method.

public function install()
{
    $pkg = parent::install();
    SinglePage::add('/dashboard/system/game', $pkg);
}