HELP! Block from custom package won't drag to page
PermalinkThe package is designed to maintain a list of vets sorted into areas of the UK.
The dashboard page is working but when I try to drag the block onto the page nothing happens... not even an error or anything
I have been puzzling this one for a while... any help greatly appreciated.
P.S I am new to custom block/package development so go easy :)
I have attached the package as a zip.
I think the problem may be that you do not have a block add.php or edit.php.
Thanks for your reply. That was my first thought also. However as I was new to block and package development I developed this package using the hw_simple_testimonials block as this uses the same principle. This doesn't have a add or edit.php file in the block directory yet still works.
Sorry I am new to development. I have based this package on the HW Simple Testimonials package as this applies the same principle. My package is set up in exactly the same way.
First one: In the block's controller at the top you have.
protected $btTable = 'btVets';
It should be
protected $btTable = 'btvetsblock';
Second one: in the block's view file you have
<?php foreach ($vetlist as $vl) : ?>
it should be
<?php foreach ($Vetslist as $vl) : ?>
After correcting those 2 things it worked for me
thank you very much
That gets me 50% of the way there but now when I add the block it adds it to the page. As soon as I save or publish the page I get the following exception (I have debugger output turned on):
'Invalid argument supplied for foreach()'
I am getting this on this line in the view.php file (Line 5)
<?php foreach ($VetsList as $vl) : ?>
A silly Typo... you were spot on... Thank you very much mate. I owe you one.
In your block's controller, at the top you have
use \Concrete\Package\Vets\Src\VetSingleList;
change it to
use \Concrete\Package\Vets\Src\VetPageList;
Then lower down, in the view function, you have
$vetList = new VetSingleList();
Change that to
$vetList = new VetPageList();
I don't know if that will solve the problem but you have to table definition db.xml, one at the package level defining table btVets and another one at the block level. Problem is, the one at the block level defines table btVetsblock but also defines the same table btVets as the package level. That might confuse C5 not knowing which to attach to what?