Jump to content

Template dropdown options not working on add new page


dazzyweb
 Share

Recommended Posts

Hi

I have processwire 2.4 installed.

When i add a new page I noticed that the drop down under Templates only displays one option with no other templates available to choose from. If I then enter title and name and click save and go to settings then all template options are available.

Has anyone else experienced this?

I assume this is not normal behaviour.

The previous version of processwire worked fine so I assume this is an issue with 2.4.

Link to comment
Share on other sites

php version 5.5.9

I have have it installed on my local windows machine using xampp.

Also tested on other environments. Tested other php versions as well and still the same

I can send you a link with login details for you to see.

Link to comment
Share on other sites

..before that...I am wondering whether you have corrupt files...Have you tried with a fresh install (as in getting a new copy of at "wire" or of the whole 2.4)...It seems your issue has nothing to do with PHP version if you have tested with different versions...I am on xampp as well, btw...Any errors? Have you tried with debug=true?

Link to comment
Share on other sites

Not sure if this is the same as it is just a demo version with maybe some restrictions but when i go to the processwiire demo version on the processwire skyscrappers site http://processwire.com/skyscrapers/admin/page/

The problem appears to be there as well.

I click 'new' on skyscrappers and there is only the basic page option available under template on the add new page.

If i then go to edit > settings i then see all available template options.

Link to comment
Share on other sites

I'm stumped. I have downloaded the stable version of PW and tried and it works fine (earlier I was testing with a dev version)...it must be an environment issue, but don't know what atm. I'm using PHP 5.4.22. I think we also confirmed it is not a template access issue...no?

Edited by kongondo
Link to comment
Share on other sites

I click 'new' on skyscrappers and there is only the basic page option available under template on the add new page.

If i then go to edit > settings i then see all available template options.

That is because of the way the family structure is set up on the Skyscrapers demo.

If you look at the settings of the actual templates, most of them either cannot be used for new pages or have to have a specific parent. So the only option left for a child of the homepage template is basic-page.

Link to comment
Share on other sites

That is because of the way the family structure is set up on the Skyscrapers demo.

If you look at the settings of the actual templates, most of them either cannot be used for new pages or have to have a specific parent. So the only option left for a child of the homepage template is basic-page.

Yes I can see that now.

I suppose the problem I am having then is why am I able to see all template options after I create a page under settings?

The templates that cannot be used  for new pages don't show up as an option when i first click to add a new page but once the page is created they are available as an option under settings.

It seems the issue is not what i thought it was. It appears that the settings for templates don't work correctly once the page is created as all the templates are available to choose under settings once the page has been created even though they can't be used for new pages.

I suppose once a page has been created then it is no longer a new page so in theory the restricted templates could be made available but is that the correct way this should work?

Surely the template that cannot be used for new pages should still be restricted on the new pages created?

Link to comment
Share on other sites

Dazzyweb...,

You set up clearly has a problem. Like I said, I have tested this on a site where there are no template restrictions and all the templates load fine. I don't think there are template restrictions in the default profile (except for "home"), so, you should see all templates loading. 

Edit:

It's been forever since I installed the default PW site; let me test with that now, a fresh install and will report back...

Edited by kongondo
Link to comment
Share on other sites

Okay, I think this is to do with how Ryan has set up the demo.

Just checking on a site I am currently working on, I tend to restrict what children as well as what parents. 

If you edit a page and the parent template does not have a restriction on templates for children, then you will get all the choices ...  er, I think. 

If you go to one of the architects and look at the settings you will see that you can only choose architect as the template. That is because the "architects" template has a restriction on children

Link to comment
Share on other sites

OK, edit...this is now strange..

When editing the pages (like Dazzyweb said), I can now see all the other restricted templates as well (under settings) and I can even assign them to this page! For instance, the template "sitemap" has family restrictions: "no children" and "no new pages", yet, I am able to assign new pages to this template! What gives?! Uh?

Just to clarify...the "no children" bit is working fine; I cannot add children...either via the tree or in children when editing the page since "children" is not visible...So working fine

Edited by kongondo
Link to comment
Share on other sites

Do you mean when you create a new page you can use the sitemap template when creating or use it when editing the settings?

1. Create a page: sitemap will not be available in the templates drop down - which is expected due to Template Family restriction (no new pages)

2. Edit the new page:  sitemap is available under "settings". OK, so I thought I'd get an error if I tried to change the template to sitemap but nada! I am able to do it

I have also tested with search template...

The only Family restriction working fine is "no children"

Link to comment
Share on other sites

The reason I ask is because editing a page is not creating a new one, if you see what I mean.

No new pages is about what you can create where as the parent child relationships are about what a particular existing page is allowed to be.

Link to comment
Share on other sites

Is

The reason I ask is because editing a page is not creating a new one, if you see what I mean.

No new pages is about what you can create where as the parent child relationships are about what a particular existing page is allowed to be.

What is the point of restricting the use of a template for new pages if after the page is created any template can be assigned to it via edit > settings?

Surely this is not the way it is supposed to work or am I missing something here?

Link to comment
Share on other sites

What  is the point of restricting the use of a template for new pages if after the page is created any template can be assigned to it via edit > settings?

Surely this is not the way it is supposed to work or am I missing something here?

I agree. Like I said, for the "no children" allowed setting, it works just fine; no children can be created using "new" in tree and the children tab is hidden when editing pages using that template. Likewise, logically, I would have thought that the template setting ..."no new pages" aka "parents" would be respected throughout...Unless there is some other thinking Ryan had? But, look at his is comment in the code in the Class Template:

'noParents' => '',   // set to 1 to cancel use of parentTemplates

I'm going to test with older versions of PW to see what the behaviour was then...or have you tested?

Link to comment
Share on other sites

I have tested with 2.2.4 and the "no parent" behaviour is similar to the present; not visible at create ("add") but visible and permissible at "edit" within the "settings" tab...[i.e., ignores "no parent" setting] I still don't get the logic...We'll have to wait for Ryan to chime in  :)

Link to comment
Share on other sites

Not sure I remember correctly, but template changing might be possible just for superuser to make development faster. Not all agrees with this is good practice and there is an GitHub issue filed already. If I remember correctly you ;)

  • Like 2
Link to comment
Share on other sites

I suppose the point is that the current system allows different actions for creating a new page and editing an existing page so you have fine grained control. It works well enough, but rather confusing!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...