Context - What is $context

Context is basically, well, the context of this page view. In other words, it's what makes one view different from the next or last. Maybe there are more or less boards... maybe someone posted a new topic... these are all things the template context can tell you. The same context information isn't available everywhere. For example, the list of boards you can move a topic to isn't there when you are editing your profile because that's illogical.

Using $context
$context is used when you want to store data to be displayed in a template, or when you need to carry data from one function to another (though parameters should be used where possible instead).

Before using $context, you need to add it as a global to your function.