$template->section = 'index'; $template->content = 'playback'; // register current controller in SESSION $_SESSION['controller'] = 'playback'; } } else { $template->section = 'error'; $template->content = 'error'; // register current controller in SESSION $_SESSION['controller'] = 'error'; } // set devmode $template->dev = $devmode; // plates: render layout (if you want to output direct, set $tplfile = 0 into controller) if ($tplfile !== 0) { echo $template->render('default_lo'); } // close palyer backend connection if ($activePlayer === 'MPD') { // close MPD connection closeMpdSocket($mpd); } elseif ($activePlayer === 'Spotify') { // close SPOP connection closeSpopSocket($spop); } // notifications $notifications = $redis->hGetAll('notifications'); if (!empty($notifications) && $tplfile !== 0) { foreach ($notifications as $raw_notification) { wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'ui_notify', 'args' => $notifications, 'delay_us' => 450000)); }
/** * Render a template file * * @param string $template The template pathname, relative to the template base directory * @param array $data Any additonal data to be passed to the template. * @return string The rendered template */ protected function render($template, $data = null) { $platesTemplate = new \League\Plates\Template($this->getInstance()); $platesTemplate->data($this->all()); return $platesTemplate->render($template, $data); }