Custom Block screwes the Page completely (PHP Error)
Permalinkafter succeeding on getting my custom theme's area to work and installing my custom block i'm experiencing some php errors caused by my block.
It now says
Fatal error: Block::getInstance(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "FullwidthBlockController" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /srv/www/htdocs/concrete5/concrete/models/block.php on line 329
And this makes my site uneditable and even unvisible.
Any suggestions?
Thanks!
Maybe it's my code:
<?php class FullwidthBlockController extends BlockController { var $pobj; protected $btName = "Full Width"; protected $btDescription = "Full width block for the default page template, background opaque"; protected $btTable = 'btFullWidth'; protected $btInterfaceWidth = "350"; protected $btInterfaceHeight = "300"; } ?>
But thats hard to imagine?
I now added the following function because I read it will permanently fix the issue.
public function uninstall(){ Cache::flush(); //remove items from cache return parent::uninstall(); }
I read that over here:http://www.concrete5.org/community/forums/usage/fatal-error-blockge...
It sadly doesnt work.
Only way by now is clearing the cache each time I added a block O_ò
Any suggestions?
Thanks
It seems you've lost your way.
1. Don't do that Cache::flush() stuff. You flushing the entire site cache when you do that. If someone has a site with 300 pages they'll have such a sad time :(
2. @andrew gave you what you probably need to know
directory should be
/full_width/
controller.php should look like
class FullWidthBlockController extends BlockController { protected $btTable = "btFullWidth"; protected $btInterfaceWidth = "400"; protected $btInterfaceHeight = "400"; protected $btCacheBlockRecord = true; protected $btCacheBlockOutput = true; protected $btCacheBlockOutputOnPost = true; protected $btCacheBlockOutputForRegisteredUsers = true; protected $btCacheBlockOutputLifetime = CACHE_LIFETIME; public function getBlockTypeName() { return t('Full Width'); } public function getBlockTypeDescription() { return t('Full Width Block description.'); }
Make sure you have a db.xml file that looks something like
<?xml version="1.0"?> <schema version="0.3"> <table name="btFullWidth"> <field name="bID" type="I"> <KEY /> <UNSIGNED /> </field> <field name"someDataField" type="C" size="255"> <DEFAULT value="blah" /> <NOTNULL /> </field> </table> </schema>
I made the changes @andrew and you suggested but it clearly didn't work out either
It's still the same error message :(
Had to clear the cache one last time!
Seems to be working now :D Thanks!
EDIT: Must have been the case sensivity on controler names
I'm developing my site on a WAMP and WAMPSERVER does not have all the required PHP modules/extensions installed by default.
I've just had to enable cURL, ZIP and openssl
http://www.concrete5.org/documentation/background/system_requiremen...