mhamurray Posted October 6, 2017 Share Posted October 6, 2017 I am working on the backend structure that will contain the data for the finished website. I have already collected data via a number of pages and sub-pages all created successfully with their corresponding templates. I have just added a new page under 'home' with a sample sub-page but when I went to apply the template I wanted to that page it was not visible in the 'settings' dropdown list. The content of this list seems to vary depending on where you are on the tree. The 'home' page has all the templates listed. What is it that determines which template can be used on any particular page and how can I access the template I need? Link to comment Share on other sites More sharing options...
abdus Posted October 6, 2017 Share Posted October 6, 2017 Go to to a Setup > Templates. Pick a template, open Family tab, you'll see the list of allowed templates there 1 Link to comment Share on other sites More sharing options...
mhamurray Posted October 6, 2017 Author Share Posted October 6, 2017 Many thanks Abdus - I have just checked through all my 'family' settings and they appear to be correct. if I select home->edit->settings->template I can see all my templates. If I want to create a new page under 'home' and select home->new->templates I am restricted to just the templates on the existing top level pages. Interestingly I put some pages into 'trash' and this allowed me to select any template but would not allow me to restore the pages. I don't know whether something has been corrupted or I have missed some steps somewhere. I am using ProcessWire 3.0.62 Thanks again, Michael. Link to comment Share on other sites More sharing options...
abdus Posted October 6, 2017 Share Posted October 6, 2017 Ok, I've checked out the source. It could also be a permission issue. Check if you changed access settings for a role. // ProcessPageAdd.module /** * Returns an array of templates that are allowed to be used here * */ protected function ___getAllowedTemplates($parent = null) { // ... $templates = []; // ... foreach ($allTemplates as $t) { if ($t->noParents == -1) { // only 1 of this type allowed if ($t->getNumPages() > 0) continue; } elseif ($t->noParents) { continue; } if ($t->useRoles && !$user->hasPermission('page-create', $t)) continue; if (!$t->useRoles && !$parentEditable) continue; if (!$t->useRoles && !$user->hasPermission('page-create', $parent)) continue; if (count($allParents) == 1) { if (count($parent->template->childTemplates)) { // check that this template is allowed by the defined parent if (!in_array($t->id, $parent->template->childTemplates)) continue; } } if (count($t->parentTemplates)) { // this template is only allowed for certain parents // ... } // ... $templates[$t->id] = $t; } // ... $this->allowedTemplates = $templates; return $templates; } Link to comment Share on other sites More sharing options...
mhamurray Posted October 7, 2017 Author Share Posted October 7, 2017 Thanks Abdus, I checked all the permissions but could not identify any changes. However, when I said I had checked all the page 'family' settings I had omitted to check the 'home' page. When I did I found a list of 'allowed' templates which excluded the one I was trying to add. I have added it and all is OK - at least to that stage! With your advice I now have a better understanding of how this template process works - much appreciated. Many thanks, Michael (79 years young) 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now