Automaticly adding attibutes to page types?
Permalink
I have seen this done in the default concrete5 theme and it works on some of my pages. But for some reason on a page that I keep trying to make, adding custom attributes and assigning them in the default page set-up are not working.
I will use concrete5's 'Page' type using default.php as an example.
When you do a fresh install of concrete5 there is a layout called 'Page'. If you chose to use the 'Page' layout when you create a new page it will automatically have 'exclude from nav' checked and you can enter meta data if you look under properties.
I have gotten this to work before, by creating a new page type, then the first thing I do is hit edit, pick which attributes I want to show and chose the thumbnail. Then save. After that I click on 'defaults' go to properties, set the attributes, (like custom class names, default header images etc.), maybe add a global content block, and save.
Then any page created with my new page type has all my settings. But for some reason I can't get this to work anymore. I have tried the above steps over and over.
Is there anyway this can be forced?
I fount this article:
http://www.concrete5.org/documentation/how-tos/developers/how-to-in...
But I stopped after reading 'package controller.' I am making a site theme not a package theme. Do all the same rules apply?
Can you create a controller file for themes or will this script be fine in the header?
Any help would be awesome.
I will use concrete5's 'Page' type using default.php as an example.
When you do a fresh install of concrete5 there is a layout called 'Page'. If you chose to use the 'Page' layout when you create a new page it will automatically have 'exclude from nav' checked and you can enter meta data if you look under properties.
I have gotten this to work before, by creating a new page type, then the first thing I do is hit edit, pick which attributes I want to show and chose the thumbnail. Then save. After that I click on 'defaults' go to properties, set the attributes, (like custom class names, default header images etc.), maybe add a global content block, and save.
Then any page created with my new page type has all my settings. But for some reason I can't get this to work anymore. I have tried the above steps over and over.
Is there anyway this can be forced?
I fount this article:
http://www.concrete5.org/documentation/how-tos/developers/how-to-in...
But I stopped after reading 'package controller.' I am making a site theme not a package theme. Do all the same rules apply?
Can you create a controller file for themes or will this script be fine in the header?
Any help would be awesome.
Thanks, this is exactly what I have been doing (read above) It refuses to work, brand new clean page, this will not work.
Example, I create a new page type 'news' which uses default.php. Yay! works.
Then immediately, first thing i do without assigning, is hit edit->pick thumbnail, chose custom attributes I have made. Save. works-> Yay!
Then, click 'defaults' for the 'news' page type, go to properties-> check custom attributes like class name add image, add custom meta's whatever. save.
Now I create new page using 'news' layout. Nothing. Custom attributes are cleared of the defaults I set, I have add them back.
Setting 'Page Type'->'News->'defaults' is pointless if the defaults are not really defaults, I don't understand why it is not working. I have tried this path 5 times, maybe it is a bug because it worked with the ones I made BEFORE I activated the template.
Example, I create a new page type 'news' which uses default.php. Yay! works.
Then immediately, first thing i do without assigning, is hit edit->pick thumbnail, chose custom attributes I have made. Save. works-> Yay!
Then, click 'defaults' for the 'news' page type, go to properties-> check custom attributes like class name add image, add custom meta's whatever. save.
Now I create new page using 'news' layout. Nothing. Custom attributes are cleared of the defaults I set, I have add them back.
Setting 'Page Type'->'News->'defaults' is pointless if the defaults are not really defaults, I don't understand why it is not working. I have tried this path 5 times, maybe it is a bug because it worked with the ones I made BEFORE I activated the template.
Unfortunately the Page Defaults doesn't actually work with attributes (only with blocks you add to the page). It is a mistake that it even gives you the option to set those because they're not actually "hooked up" to anything (this toolbar button will be removed in future versions of C5 to avoid confusion).
I'm honestly not sure how you were getting default attributes before -- it's possible you had some kind of addon or something that did this?
I'm honestly not sure how you were getting default attributes before -- it's possible you had some kind of addon or something that did this?
I don't know, I will have to look into this again, to be honest concrete5 is extremely buggy. I've had pages that will not update no matter what I try, I have had issues with custom package themes not taking on the home page (in all fairness, it could have been the packages) and have had to completely get rid of the installed package before c5 would use my custom template.
You are right about this one, there does not same to be an easy way to include these. Looking at the tutorial again I think importing the attributes should work, I will just need to find time to try it.
You are right about this one, there does not same to be an easy way to include these. Looking at the tutorial again I think importing the attributes should work, I will just need to find time to try it.
Look for the Page Type that you wish to add blocks to as default, click on the button that says "Default" for the particular page type, a new window then opens up, you could add blocks as defaults also, add the custom attributes that you wish to see whenever a page with that particular Page type is created as defaults, save the changes and then try to create a new page with a particular page type that you set defaults for to see if you are getting the attributes or blocks that you set as defaults