Custom Block screwes the Page completely (PHP Error)

Permalink
Hi,
after 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!

SlapY
 
pmlmedia replied on at Permalink Reply
pmlmedia
This probably doesn't help, but I've just been caught out by my system 'not meeting the minimum requirements for C5'
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...
SlapY replied on at Permalink Reply
SlapY
As far as I know, it does match all these requirements.

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?
SlapY replied on at Permalink Reply
SlapY
Hey,
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
andrew replied on at Permalink Reply
andrew
If your block's directory name is "full_width" you need to make sure the controller name is FullWidthBlockController (note the capitalization of FullWidth, not Fullwidth.)
SlapY replied on at Permalink Reply
SlapY
I made sure the controller is named correctly but it didn't help either :/
mkly replied on at Permalink Reply
mkly
slapY my man,
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>
SlapY replied on at Permalink Reply
SlapY
Back on the block!

I made the changes @andrew and you suggested but it clearly didn't work out either

It's still the same error message :(
SlapY replied on at Permalink Reply
SlapY
Sorry guys :O

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