Package install single page custom theme

Permalink
Hi all,

I want to create a package with a single page, which has a custom theme. So i can create a package and add the single page to the theme folder which is currently active MANUALLY, but how do i add that single page to the current theme with the install function of the package.
I add the single page in install like this:
$p = SinglePage::add('
pagename',$pkg);
      if (is_object($p)) {
         $p->update(array('cName'=>t('Pagename'), 'cDescription'=>t('PageDescription')));
      }


Any help would be really appreciated. Thanks in advance!

 
enlil replied on at Permalink Reply
enlil
Example taken from the Boilerplate package:

private function installSinglePages($pkg) {
      $path = '/dashboard/boilerplate';
      $cID = Page::getByPath($path)->getCollectionID();
      if (intval($cID) > 0 && $cID !== 1) {
         // the single page already exists, so we want
         // to update it to use our package elements
         // this might not be OK for marketplace stuff if
         // you are modifying the core single pages
         Loader::db()->execute('update Pages set pkgID = ? where cID = ?', array($pkg->pkgID, $cID));
      } else {
         // it doesn't exist, so now we add it
         $p = SinglePage::add($path, $pkg);
         if (is_object($p) && $p->isError() !== false) {
            $p->update(array('cName' => t('Boilerplate')));
         }


Then under:
$pkg = parent::install();

add
$this->installSinglePages($pkg);
incredikill replied on at Permalink Reply
Thanks for your answer, but how is this single page installed in the current theme? Thats my problem, now you install the page when it already exists it updates. But i only want to install a new single page.