setTemplate($templateName); // Check if the forum exists if (!$forum) { // Set render data $renderData['page'] = [ 'title' => 'Information', 'message' => 'The subforum you tried to access does not exist.', ]; // Set parse variables $template->setVariables($renderData); // Print page contents echo $template->render('global/information.tpl'); exit; } // Check if the forum isn't a link if ($forum->type === 2) { // Set render data $renderData['page'] = [ 'title' => 'Information', 'message' => 'The forum you tried to access is a link. You\'re being redirected.', 'redirect' => $forum->link, ]; // Set parse variables $template->setVariables($renderData); // Print page contents echo $template->render('global/information.tpl'); exit; } $renderData['forum'] = $forum; // Set parse variables $template->setVariables($renderData); // Print page contents echo $template->render('forum/viewforum.tpl');