Error in Package blocks

Permalink
Hi

I created a simple package and created a block using the "basictest" block referenced in the documentation.

The I installed the package in the Dashboard - add functionality

When I add the block to a page, I get the following error:

Fatal error: Block::getInstance() [<a href='block.getinstance'>block.getinstance</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;BasicTestBlockController&quot; 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 /concrete/models/block.php on line 328

Any hints to what I am doing wrong...?

Bonosoft
 
Bonosoft replied on at Permalink Best Answer Reply
Bonosoft
To reply to my own question:

Because I took the code for the block directly from the Basic Test sample provide in the Concrete5 documentation area, I ruled out errors there.

To simplify the setup I moved the block from the package I created to the block folder in the root of the concrete5 installation, uninstalled the package and installed the block - but got the same error.

Then I made the equivalent of "Restart your computer" by uninstalling the block, deleting it completely and then unpacked it again from the downloaded zip file. I noticed a small, but as it turned out very important difference. The name of the folder for the block was "basictest" but after unpacking the code again it was "basic_test". When checking the controller.php the btName is "Basic Test" which probably explains why there must be an underscore in the folder name, representing the space character.

I changed the folder name in the package version, and now "it just works" - yes I am on an iMac ;-)

So one lesson learned today, be sure to name the folders correctly.
danielberkompas replied on at Permalink Reply
I'm having this issue, except I'm not adding a block, (only a package so far) and the error is attaching to the AutoNav block instead. Seems rather odd. Any ideas?

*Edit: I am adding a block, but it's name is "Sermons," so there isn't an issue with spacing or naming, from what I can tell.
kranthikumar replied on at Permalink Reply
kranthikumar
HI First clear your CACHE
here is cache option available :dashboard/system/optimization/clear_cache/

then refresh your error page then your error is gone.

thank you.
gicara replied on at Permalink Reply
gicara
I had the same Error in my self coded Block.

After disabling the caching feature, everything worked as expected.

I think i did the mistake in my controller.php. I'm still investigating ... Propably in the "function on_page_view()".