Unexpected Errror when adding a new page

Permalink
I'm doing a fresh install. I've only just installed and activated the template and then I try to add a page and I get this:

Argument 1 passed to Concrete\Core\Page\Type\Type::createDraft() must be an instance of Concrete\Core\Page\Template, null given, called in /home/tucker25/public_html/concrete/concrete/controllers/backend/page.php on line 30 and defined


I don't know if it is related or not, but when I was setting up the site on a localhost I started to get another error when adding a new page. I figured I had messed something up and decided to set the site up fresh on a server.

An exception occurred while executing 'select cID from Pages where cParentID in () and cInheritPermissionsFromCID = ': SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and cInheritPermissionsFromCID =' at line 1


I have absolutely no idea what this could be, but my project is scuttled until I can find a solution.

 
tukuro replied on at Permalink Reply
I think I may have figured out what caused it. I'm not 100% sure, but this should be looked at for future versions since it's fairly easy to do and I don't know if there's a good way to fix it.

When I first uploaded my template I accidentally uploaded an old version. When I realized that, I uninstalled and deleted the template and then uploaded the new version and installed it. The new version had the same name. I realize now that what I should have done is simply overwrite the old version with the new version via ftp, but I wasn't thinking and I deleted and replace it through the concrete5 dashboard instead. I think somehow having two templates with the same name broke the system. I'm not completely sure but that's my theory.

The error I got previously seems to have had something to do with messing around with page types. But really this is all a bit over my head.

There should really be something in the concrete5 system that can either handle this situation or prevent the user from doing it. I still have no idea how to fix it. Since it's a new site I ended up erasing the site and database completely and starting over. It seems to work great now. But this could have been a huge problem with a finished site.
PropagandaSam replied on at Permalink Reply
Not exactly sure how I managed to cause this error myself, but I was able to fix it by changing the site's theme to Elemental and then back to my custom theme. Just a little something you can try if running into this error.
dangrth replied on at Permalink Reply
Did you manage to find a workable solution ? I'm running into exactly the same problem while doing theme development and now I'm unable to create new pages on the site...
tukuro replied on at Permalink Reply
I wish I could be more helpful but I ended up starting over with a fresh install of Concrete5 and installing my theme again. I still think the problem areas are something to do with page types and the theming system. If you do everything exactly the way you are intended to then it works, but it's very easy to accidentally break the system in a way that is confusingly difficult to fix.

Things that I would try if a new install is unworkable:

- Switch to the Elemental theme and switch back as another user suggested
- install your theme again with a different name. installing a theme twice with the same name seems to have caused one of my problems

I'll try and remember other things that seemed to help and report back. It's been a little while since I dealt with this.
dangrth replied on at Permalink Reply
I have recreated all my page types from scratch and then deleted the old ones. This seems to have corrected the situation.
I probably did put the system in an unstable situation - the problem is that it's difficult to avoid doing hazardous manipulations when you're in the rush of development....
tukuro replied on at Permalink Reply
I agree. I've had a good experience with Concrete overall, but it's a little too easy for comfort to break the system in ways that are very confusing to fix.
maar replied on at Permalink Reply
maar
5 good advices for develop themes.

1. Always develop with the cache turned off
2. Enable full debugging environment
3. Do regularly database backup (to get back to before it breaks).
4. Always try to debug your code before debugging the core.
5. Do revision backup of your files to be able to get back to a point where it works.

I have now made 7 full sites (4 with custom themes), and during development it broke a lot. 9 out of 10 times the error is in the code you write, so it should always be possible to get out of trouble basically by correcting the code.

Remember that software development is all about code written in files. And one fault character can break anything.

Just my ten cent...
Blueprint replied on at Permalink Best Answer Reply
Blueprint
I know this thread is a few years old but I just ran into the same error on a recent 5.8.4 site. It's a pretty big and complex site so didn't want to mess around with deleting page types. The problem was solved for me by just going into the Page Types screen clicking on 'Basic Details' against each page type and then saving without making any changes. This seems to fix any issues with the page type template and I can add pages again.