5.7.3.1 - Error on create page - getPageTemplateID()
Permalink 1 user found helpfulBut when pressing the final button to create the site I get the following error message:
{"error":{"message":"Call to a member function getPageTemplateID() on a non-object"},"errors":["Call to a member function getPageTemplateID() on a non-object"]}
No matter what page type I choose, it's always the same error. I have to add to this, that I did delete a few of the existing page types (left_sidebar, right_sidebar, ...) before that error started to show up. But I didn't delete the ones I was using, only the ones I thought the client will not need. So this error needs to be connected I guess...
All that did help was to play a backup of the whole site in. That worked ;)
Seems that the Page Type "Page" does have the wrong default template active.
Unfortunately if you change that via GUI, you ran to the same error (Themes > Page Types > Page Details)
Seems this happens if you delete the default page type.
The solution was to fix the id in the database.
First get the ID from a template that you want to chose as default (SELECT * FROM PageTemplates). E.g. 19
Now you have to change the default id (UPDATE PageTypes SET ptDefaultPageTemplateID = 19 WHERE ptHandle="page").
Hope that helps. Without guarantee.
I like to clean up templates by deleting un-used page types and page templates but this cleaning caused the problem by deleting the default page template.
I will try to avoid deleting the default page type from now on.
I couldn't create pages anymore, the error message was:
{"error":{"message":"Call to a member function getPageTemplateID() on a non-object"},"errors":["Call to a member function getPageTemplateID() on a non-object"]}
I followed your advice, but i found that the default ID was correct, instead i noticed a "C" in the table row "AllowedPageTemplates" for the page type "Page". Changing it to "A" solved the problem.
Actually i have no clue why that worked and what A or C means in ptAllowedPageTemplates...
I have now learnt to treat Page Template deletion with more caution..
I get same error, "Call to a member function getPageTemplateID() on null", and sometimes also error stating I don't have permission to post a page here.
My scenario was that I deleted a page to do it over then went to trash and emptied it so I could create a page with the same name and that's when errors started.
I am a novice and don't understand the resolutions and can't get this fixed, can anyone go into more detail and tell me where I need to go to resolve?
Thank you.
2. Make a new connection (ctrl+m) to your database. Give in your username/password and host address. If you have no idea what the data is you might need to ask your server hosting provider.
3. Connect to it
4. In the big white field in the middle of your screen (Tab with the name "Query") type the following: Select * from page_templates
5. Hit F9, so it processes this query
6. You should see now data to all your page templates. Choose one as your new default and read out the id of it. I don't think it matters much which one you choose.
7. Use this Id now by writing a new query into the big white field in the middle of your screen. Let's say you chose the template with Id 19. Write: Update PageTypes set ptDefaultPageTemplateID =19 where ptHandle="page"
8. Press again F9. If no error message comes it's done.
That's it. But that only works if your concrete version is somewhere along the line of what it was at the time of this post and if your problem is really the same. Don't think it would work in current versions.
# concrete5 Version
Core Version - 8.2.1
Version Installed - 8.2.1
Database Version - 20170802000000
# concrete5 Packages
C5DK Blog (8.3.2), Call Me (0.9.6), Equinox (1.0.5), Social Stream (1.2.1), Spacer (0.9.4), Whale OWL Carousel (2.5.8)
# concrete5 Overrides
blocks/call_me/templates/equinox/view.css, blocks/call_me/templates/equinox, blocks/call_me/templates, blocks/call_me
# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).
# Server Software
Apache
# Server API
litespeed
# PHP Version
7.1.26
# PHP Extensions
bcmath, bz2, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, libxml, litespeed, mbstring, mcrypt, mysqli, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib
# PHP Settings
max_execution_time - 300
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 10000
memory_limit - 768M
post_max_size - 128M
sql.safe_mode - Off
upload_max_filesize - 128M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
Sounds like a simple fix, can I hire someone to fix? Also checking into restoring backup through the host, I'll lose a few blog pages but can fix.
Also, I don't know if those specs work or not, it's been a long time. I guess if you can find the database tables in your version it should work.
I have two backups in the rotation now so I have one to fall back on.
I ran into a similar problem once when I deleted some page templates that were in use, so if clearing the cache doesn't help I would try adding the deleted templates or page types back and see if that makes any difference.