Block ID from the add.php or edit.php page?

Permalink
I am using concrete 5.6.3. I have created a new block for to create a simple image carousel with thumbnails. The only problem that I am having is that on the edit form the images that were already chosen are not showing up. The reason is that I cannot find the block id on the page. I have tried the following with no success.

$this->bid; -> this returns a null value

$this->controller->bid; -> this returns a null value

$b->getBlockID(); -> this returns an error about a call on an undefined object which is $b because it was never created.

Any help would be appreciated. Thanks.

View Replies:
hutman replied on at Permalink Reply
hutman
The variable is case sensitive, you should be able to access the block id using $bID
JohntheFish replied on at Permalink Reply
JohntheFish
bID does not exist during add. It only exists after a block has been added.
evolveinc replied on at Permalink Reply
Thanks that makes sense. How about for the edit.php? The block should have been added, however when I try to get the Block ID using the suggestion of hutman I still get a null object.

Here is what it look likes in the edit.php of the block:

defined('C5_EXECUTE') or die("Access Denied.");
if ($bID == null) { $bID = -1; }
echo "The block id is ".$bID.


The form still returns -1 in the edit.php.
ranawatsuyash replied on at Permalink Reply
Hey @evolveinc,

Did you find the reason $bID was returning NULL value.

I have created a custom block. And I am able to add the block perfectly fine. On adding a block a new ID is added in the database as well.

But when I try to get the $this->bID it returns NULL, also I am not able to delete the block as well because of the following error is thrown due to bID having NULL value.

Error:
An exception occurred while executing 'select * from btAddressSearch where bID=':

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Do you have any insights that can help me out.

Thanks.