Custom controller.php to add page types, add blocks, add content to blocks and add pages
Permalink 1 user found helpful
Hello all!
Thank you in advance for helping.
I've been working for 3 days in creating my own custom theme but now I've hit the wall.
So this is what I have so far in my controller.php:
So I've managed to achieve the following:
- Install my custom theme
- Install 7 custom blocks (heading_one, heading_two,etc...)
- Add 5 different page types (home,news,gallery,etc...)
So this is my first question. If I edit that controller.php file, do I have to Uninstall and Install the package to make the changes take effect?
Second question. Something I can't make it work is adding a block with some content.
In my header.php template I have
I would like to add a Content block with the text 'Add some content'
I know my code for adding a block doesn't work and I know that it makes reference to a HTML block in the Main area, but it's because I tried tried several things and now I'm completely lost.
I specially struggled getting the right value for the variable $page.
Third question is, how can I add some pages, again, using the controller.php, and assign them a page type?
Once again, I've tried several thins, read the docu, read the forum... but everything I tried didn't work at all.
Any help will be highly appreciated.
---- Summary ----
Using controller.php:
1- How to add a block to a Global Area
2- How to add some content to that added block
3- How to add pages to the template
4- How to assign a page type to the previously added pages.
Once again, thank you for helping.
Cheers
Rafael
Thank you in advance for helping.
I've been working for 3 days in creating my own custom theme but now I've hit the wall.
So this is what I have so far in my controller.php:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); class ThemeultimatePackage extends Package { protected $pkgHandle = 'theme_ultimate'; protected $appVersionRequired = '5.5.2'; protected $pkgVersion = '1.0'; public function getPackageDescription() { return t("Installs the " . $this->getPackageName(). " theme."); } public function getPackageName() { return t("Theme ultimate"); } public function install() { $pkg = parent::install(); // Load stuff we need
Viewing 15 lines of 82 lines. View entire code block.
So I've managed to achieve the following:
- Install my custom theme
- Install 7 custom blocks (heading_one, heading_two,etc...)
- Add 5 different page types (home,news,gallery,etc...)
So this is my first question. If I edit that controller.php file, do I have to Uninstall and Install the package to make the changes take effect?
Second question. Something I can't make it work is adding a block with some content.
In my header.php template I have
<?php $a = new GlobalArea('description'); $a->display($c); ?>
I would like to add a Content block with the text 'Add some content'
I know my code for adding a block doesn't work and I know that it makes reference to a HTML block in the Main area, but it's because I tried tried several things and now I'm completely lost.
I specially struggled getting the right value for the variable $page.
Third question is, how can I add some pages, again, using the controller.php, and assign them a page type?
Once again, I've tried several thins, read the docu, read the forum... but everything I tried didn't work at all.
Any help will be highly appreciated.
---- Summary ----
Using controller.php:
1- How to add a block to a Global Area
2- How to add some content to that added block
3- How to add pages to the template
4- How to assign a page type to the previously added pages.
Once again, thank you for helping.
Cheers
Rafael