Forum

Thread tagged as: Problem, Error

Perch 2.7 breaks Master Pages

Hullo,

Updated an in-progress project from 2.6.6 to 2.7 today and it appears I can no longer add new Master Pages.

IE –

  1. Add test.html to perch/templates/pages/
  2. Log in to Perch admin
  3. Click Master Pages link
  4. Refresh the page and test.html is not listed

Whereas following the same steps in 2.6.6 results in test.html appearing in the list of Master Pages so it can be set up for use when adding a new page.

FYI test.html was created by duplicating a master page that already existed/was working from the 2.6.6 build, so I don't suspect the page itself is at fault.

Let me know if I can provide any more details.

UPDATE

Looks like not only can I not add new master pages, but also cannot add new pages which reference a Master Page, full-stop.

IE –

  1. Click Add New Page
  2. Choose Master Page (working in 2.6.6) production.html
  3. PHP white screen

Here's a couple of errors from the PHP log:

[23-Oct-2014 23:50:16 UTC] PHP Warning:  include(): Failed opening 'admin/templates/pages/production.html' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.4/lib/php') in /path/to/project/index.html on line 1
[24-Oct-2014 00:04:12 UTC] PHP Fatal error:  Call to a member function pageSubpageRoles() on a non-object in /path/to/project/admin/core/apps/content/PerchContent_Pages.class.php on line 497
Richard Terrick

Richard Terrick 3 points

  • 7 years ago

Hi Richard,

Just wanted to add that it's not only you. I also upgraded from 2.6.6 to 2.7 today and cannot add pages either.

When trying to add a page, the Parent page field shows all pages grayed out for my editors even if they have permission to add pages and to add top level pages. They can't add pages either.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We'll take a look at it this morning and see what's going on.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you confirm that this only happens when creating a new top-level page?

i.e. creating a page lower down the tree works ok?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I could be wrong, but I've checked my git commit history, and I don't think we've ever supported master pages with a .html extension. Do you have other master pages that aren't .php files?

Hi Drew,

For me, I narrowed it down to only when creating top level pages with a master page selected.

If I create a subpage with a master page selected, then it works fine.

If I create a top level page with 'page already exists, or is only a link', then it works fine also.

I've just done a clean install this morning of 2.7 and have this same issue. I can't create new pages based on master pages. I can fill in all the required fields but all I get when pressing 'Submit' is the blank white page. Here's the error in my PHP log:

[24-Oct-2014 09:58:41 UTC] PHP Fatal error:  Call to a member function pageSubpageRoles() on boolean in /perch/core/apps/content/PerchContent_Pages.class.php on line 497

Only attempting to use the standard Default.php at the moment and even that fails.

Using PHP 5.6.1.

Any help would be appreciated. Thanks.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Should be fixed in 2.7.1 https://grabaperch.com/update/

2.7.1 works great for me Drew. Thanks!

Hey Drew,

Thanks for the quick update -- 2.7.1 also fixed my issue of not being able to create pages with master page templates.

With regards to this:

I could be wrong, but I've checked my git commit history, and I don't think we've ever supported master pages with a .html extension. Do you have other master pages that aren't .php files?

I've been using master pages with .html extensions for about a year and a half. For some reason, I assumed (wrongly) that to be able to create an .html file from a master page, the master page itself had to have a .html extension (even though I had been using define('PERCH_DEFAULT_EXT', '.html'); and define('PERCH_DEFAULT_DOC', 'index.html'); in my config file as well). Since your comment, I realize that's not the case, and have switched my master templates to a .php extension and all is well. (Strange that it's worked until the 2.7 build (2.7.1 didn't "fix" this), but now that I know that I've been doing master pages wrong this whole time, it's not a big deal to update the template extensions and the references in the pages.)

Thanks again!

Drew McLellan

Drew McLellan 2638 points
Perch Support

How were you adding those master pages?

I'm not against adding support for other file extensions, I'm just surprised it worked!

Prior to 2.7/2.7.1, I could just add an .html file to perch > templates > pages and it would appear as a master page in the Perch admin.

Actually, one of the first things I do on a new project is change pages/default.php to pages/default.html. Since the docs don't mention anything about master pages needing to be PHP files, and since it just worked, I didn't think anything of it. (Also, I had assumed this would be the only purpose of define('PERCH_DEFAULT_EXT', '.html'); in the config file.)

FYI, I've opened a new thread with a related question here.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Hmm, ok. I'm going to have another look back through the change logs.