Getting the current forum id
I'm building a widget that needs to display custom content based on the forum that is being shown. I therefore need to get the forum id. I've tried using
$forumid = $forum['forumid'];
but no value is returned. How can I get the ID for the sidebar widget?