Page Type Controller not working as expected
Permalink
I've just installed 5.7.2 to see what the differences are, and have tried to set up a page controller for a new new page type called home. When I am on the homepage, it is correctly using the home.php page view, but does not display the $pageTitle variable set in the controller at this location:
/application/controllers/page_types/home.php
Although, when in the dashboard and viewing the page type defaults via:
Pages & Themes => Page Types => Home => Output => Homepage (Page Templete) => Edit Defaults, the variable I am setting is visible on the page.
The variable is just called $pageTitle.
This is the code of the controller, in it's entirety:
and this is the home.php view file at:
/applicaiton/themes/main/home.php
which is being included via the page template homepage.php at:
/applications/themes/main/homepage.php
Can anyone explian why the variable would show in the page type defaults, but not on the page itself? I have cleared the cache and turned off all caching.
/application/controllers/page_types/home.php
Although, when in the dashboard and viewing the page type defaults via:
Pages & Themes => Page Types => Home => Output => Homepage (Page Templete) => Edit Defaults, the variable I am setting is visible on the page.
The variable is just called $pageTitle.
This is the code of the controller, in it's entirety:
<?php namespace Application\Controller\PageType; use Concrete\Core\Page\Controller\PageTypeController; use Loader; use Page; use Permissions; use View; class Home extends PageTypeController { public function on_start(){ $this->set('pageTitle', 'Homepage'); } }
and this is the home.php view file at:
/applicaiton/themes/main/home.php
which is being included via the page template homepage.php at:
/applications/themes/main/homepage.php
Can anyone explian why the variable would show in the page type defaults, but not on the page itself? I have cleared the cache and turned off all caching.
Thanks Andrew,
I'll try the DB update and see if that works. I'll post a reply once done (not currently on the machine hosting that website right now).
I'll try the DB update and see if that works. I'll post a reply once done (not currently on the machine hosting that website right now).
hi there.
did u find a solution to this issue?
did u find a solution to this issue?
FYI you can now change page types in 5.7, so this could be easily accomplished through the Dashboard Sitemap without having to run a direct database query.
Thanks Andrew,
I did try the DB update you suggested, and it did work to some extent but needed some other manual changes that I can't recall offhand. I will update my installation to the newest version then follow your most recent example. Apologies for the delayed reply Andrew and Chris, I haven't been online in a few weeks.
I did try the DB update you suggested, and it did work to some extent but needed some other manual changes that I can't recall offhand. I will update my installation to the newest version then follow your most recent example. Apologies for the delayed reply Andrew and Chris, I haven't been online in a few weeks.
There are a number of technical reasons for why changing page types on existing pages is challenging, so we want to do it right. It is a bummer in this case. If you could find the ID of the page type by going into the Dashboard, hovering over the Basic Details button, and finding the number after the "/edit/" in the URL slug, you could then change it manually through the database.
That would manually do it. Not 100% sure this would solve the problem but it should get you closer.