GlobalArea broken and suddenly content cannot be added

Permalink
I currently experiment with Concrete5 on a localhost setup, creating various different themes, blocks, elements, etc.. I have a great understanding of how the basics in the system work (MVC, O/OP), but I have run into a problem I simply - by the life of me - cannot figure out.

I use the code below in the header.php file in a theme. I have several blocks in the header which use this code (with different variable and GlobalArea names), and all blocks but one work; I cannot get the dropdown menu to appear when clicking on the area called 'Nav'. It worked great at some point, but after reinstalling Concrete5 (plus database wipe) and adding the custom elements again (e.g. the theme), this specific area broke.

Here's the code:

if (Page::getCurrentPage()->cID != null) {
$nav = new GlobalArea('Nav');
if (Page::getCurrentPage()->cID != 1) {
$nav->disableControls();
}
$nav->setBlockLimit(1);
$nav->display($c);
} else {
$global_nav = Page::getByID(1);
$area = new GlobalArea('Nav');
$blocks = $area->getAreaBlocksArray($global_nav);
foreach ($blocks as $b) {
$block = Block::getByID($b->bID);
$bv = new BlockView();
$bv->render($block);
}
}

The "null"-check is so that the block will appear on all pages, e.g. the 404-page too (it borrows the setup from the front page which has cID=1). Also, I limit the block to only be editable on the frontpage.

I have tried re-initiating the Javascript controls through a small JS-hack, but with no luck. The database seems fine and all other blocks appear correctly when inserted, so I know for a fact that this works. But why does this exact block break? I've double, tripple and quadrouble checked the surrounding HTML-tags - they are correct. And the div-tag containing the area is has "position: absolute", and a specified width and height.

Also, if I replace the code above with a normal Area("Nav") (not global), the blocks appear correctly.

Thank you in advance for your help! :)

Best regards, Kafoso