Custom Block Trouble

Permalink
Morning all. I have a problem with one of my C5 sites. I created a custom block that basically shows an image and if you click on it the image is dsplayed larger... no biggie.
But now (and perhaps with the upgrade to 5.6.0.2) when the cache is on it throws an error.

Warning: require_once(/webroot/h/a/hampl001/clients/www/ADAM/concrete/concrete/blocks/f_a_q_pop_image/controller.php): failed to open stream: No such file or directory in /webroot/h/a/hampl001/clients/www/ADAM/concrete/concrete/core/libraries/loader.php on line 205 Fatal error: require_once(): Failed opening required '/webroot/h/a/hampl001/clients/www/ADAM/concrete/concrete/blocks/f_a_q_pop_image/controller.php' (include_path='/webroot/h/a/hampl001/clients/www/ADAM/concrete/libraries/3rdparty:/webroot/h/a/hampl001/clients/www/ADAM/concrete/concrete/libraries/3rdparty:.:/usr/share/pear:/usr/share/php53/pear') in /webroot/h/a/hampl001/clients/www/ADAM/concrete/concrete/core/libraries/loader.php on line 205

'faq_popimage' is the name of the block so I am not sure why c5 is adding all the underscores to it to make it 'f_a_q_pop_image'. I am getting the same sort of error on a similar block named 'popimage' but c5 has added an extra underscore to that as well to make it 'pop_image'.

I can't find any reference to the c5-altered block names so i'm not even sure how it is being called.

Like i mentioned this is when the cache is on. If I clear the cache, the block displays once... reload the page and the error returns. clear the cache and turn cache off... block displays fine.

Things I have tried... tried on two different servers both on 5.6.0.2.... tried isolating the block by using it on a fresh install of 5.6.0.2 with nothing else on the page.

Any thoughts GREATLY appreciated.

 
SlapY replied on at Permalink Best Answer Reply
SlapY
Hey

First off, make sure:
- Folder is named "faq_popimage" ?
- controller.php contains "FaqPopimageBlockController" <- Case sensitive

I guess your class is named something like FAQPopImageBlockController or maybe FaqPopImageBlockController.

As far as I know, each underscore indicates the next char must be capitalised in controller class... or something

Like:
Folder is a_b_c ... class is ABCBlockController
Folder is abc ... class is AbcBlockController
Folder is a_bc ... class is ABcBlockController
Folder is ab_c ... class is AbCBlockController

Greets
SlapY replied on at Permalink Reply
SlapY
So you probably want to rename the folder faq_pop_image and name the class FaqPopImageBlockController.

Your class is named FAQPopImage so C5 expects a folder like F_A_Q_Pop_Image.
SlapY replied on at Permalink Reply
SlapY
Oh and popimage:
Your class is probably named PopImageBlockController ... so the folder must be pop_image
Chrouglas replied on at Permalink Reply
OMG.... i'll give that a shot. I never would have figured that one out.. I'll post back to let you know/

Thanks for the super quick reply
C
SlapY replied on at Permalink Reply
SlapY
Booya!
Fast as lightning.

Mark as solution if it works, please ;)
Chrouglas replied on at Permalink Reply
Perfect mate thanks! I would have banged my head against the desk for an additional day otherwise.

Thanks again,
C