Check if Block is in use.

Permalink
How can i find out if an block still is in use and has not been deleted?

I have its ID.

Thx

teamorange
 
jordanlev replied on at Permalink Reply
jordanlev
Check out the "Cobble" addon in the marketplace -- it might help with this.
(or do you want to do this from php code?)
teamorange replied on at Permalink Reply
teamorange
Thx but what you have already written I need a PHP code directly.
Do you have an idea?
teamorange replied on at Permalink Reply
teamorange
Here my solution:

// Data you have to know from the Block:
// bID : BlockID (here: $row['bID'])
// cID : PageID from Block (here: $row['cID'])
$b = $db->query('SELECT Max(cvID) As cvID
      FROM `CollectionVersionBlocks`
      WHERE bID = '.$row['bID']);
while ($blockRow = $b->fetchRow()) { $cvIDBlock = $blockRow['cvID']; }
$p = $db->query('SELECT cvID
      FROM `CollectionVersions`
      WHERE cID = '.$row['cID'].'
      AND cvIsApproved = 1');
while ($pageRow = $p->fetchRow()) { $cvIDPage = $pageRow['cvID']; }
if ($cvIDBlock==$cvIDPage) {
//BLOCK IS IN USE
}