The $tree['tree'] portion of the array will only exist if there are subforums, so I added a check to see if that key exists and just skip the loop if it doesn't.

Thanks for the info on the missing semicolon.