The Basic controller.php file will look like this. I have put asterisks around what you need to edit. You should delete these when making your package.
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
class *ThemeMyCoolThemePackage* extends Package {
protected $pkgHandle = '*theme_my_cool_theme*';
protected $appVersionRequired = '*5.1*';
protected $pkgVersion = '*1.0*';
public function getPackageDescription() {
return t("*Installs My cool theme, an awesome Concrete5 theme*");
}
public function getPackageName() {
return t("*My Cool Theme*");
}
public function install() {
$pkg = parent::install();
// install block
PageTheme::add('*my_cool_theme*', $pkg);
}
}
Lets go through what this means.
ThemeMyCoolThemePackage
This is the name of your outer directory, with new words in caps. You then add Package after it because it is a package to lwt c5 know it can install it. So if your outer directory was named theme_awesome then this would by ThemeAwesomePackage
theme_my_cool_theme
this is the outer directory of your theme, nothing fancy. So for this package the outer directory would by theme_my_cool_theme
5.1
this is the version of c5 that your package needs to one- change 5.1 to whatever is required
1.0
this is the version of your package, it will be 1.0 initially but then will need to be changed for future updates
Installs My cool theme, an awesome Concrete5 theme
what you want the description to be on the add functionality page.
My Cool Theme
what you want the title to be on the add functionality page. my_cool_theme
the name of the directory inside the themes folder
so this theme would look like this
theme_my_cool_theme
icon.png
controller.php
themes
my_cool_theme
themecontents
you can apply a theme to your site on install with this: $myCoolTheme = PageTheme::add('my_cool_theme', $pkg); $myCoolTheme->applyToSite(); thanks @sashi for this code.