How to add a singlePage to package install

I am still a bit of a noob with C5, but I'm slowly learning. I am trying to build my first package for a client and they want a custom member listing so I have modified the members single page. I also have another single page with a controller. Both are working when I manually copy the files into the appropriate directories but now I want to have them install as part of a package.

I can't figure out what to call to install a controller through the package controller.php. For the single pages, I tried adding a SinglePage::add('members', $pkg) but the install fails because it can't find the class SinglePage. I'm not sure what to include. I've tried looking for some examples and I couldn't find any.

Thanks for any help you can give.

View Replies:
cgrauer replied on at Permalink Reply
ace replied on at Permalink Reply
I suggest including the package so it will uninstall properly. Change the path on add for the following if you want it elsewhere besides the dashboard
// add single page to dashboard folder on install
   public function install() {
      $pkg = parent::install();
      // install single page
katalysis replied on at Permalink Reply
I'm trying to use this to update an existing dashboard page with some more options but it doesn't seem to work.

The modified page loads instead of the core one if installed in /single_pages but doesn't seem to install as part of a package.

Should I expect it to or is there another method to use?

public function install() {
      $pkg = parent::install();
      // install pages
      SinglePage::add('/dashboard/pages/themes/customize', $pkg);
mose replied on at Permalink Reply
Your single page needs to be located in


In other words, you need to match the directory structure of the original page but inside your package.
katalysis replied on at Permalink Reply
I'm sure I have the page in the correct place -I can install a new page into the dashboard page structure without a problem.
The issue is that if I try to add a new version of an existing page it is ignored.
Vinzent replied on at Permalink Reply
This problem(?) is still around, exactly what katalysis said, the SinglePage:add doesn't allow to overwrite existing (dashboard) pages.
Could this be fixed in the next version of C5?
For example:

When i manually move the file
it works.

But when using
SinglePages:add('/dashboard/system/optimization/jobs', $pkg);
it doesn't
ScottC replied on at Permalink Reply
I can confirm that is the truth. I spent a few hours trying to get this to work via this method, but I ended up falling back to doing the following:

upon package install, i dropped into the database and wrote the packageID association to the single page.

upon package uninstall, before i called parent uninstall, i modded the page record to have a packageID of 0.

It works fine. Certainly not ideal, but I tried a lot of things before moving on.
Vinzent replied on at Permalink Reply
Hmm could you give a piece of code, from the install() and uninstall() you use to accomplish this?