Example #1
0
 public function testActionMethodExists()
 {
     $engine = new \League\Plates\Engine();
     $ext = new \werx\Url\Extensions\Plates();
     $engine->loadExtension($ext);
     $template = new \League\Plates\Template($engine);
     $this->assertTrue(method_exists($template->url(), 'action'), 'The action method from werx\\Url\\Builder should be available');
 }
Example #2
0
 *
 */
// load configuration
include $_SERVER['HOME'] . '/app/config/config.php';
// main include
include $_SERVER['HOME'] . '/app/libs/vendor/autoload.php';
// open session
session_start();
// plates: create new engine
$engine = new \League\Plates\Engine('/srv/http/app/templates');
// plates: load asset extension
$engine->loadExtension(new \League\Plates\Extension\Asset('/srv/http/assets', true));
// plates: load URI extension
$engine->loadExtension(new \League\Plates\Extension\URI($_SERVER['REQUEST_URI']));
// plates: create a new template
$template = new \League\Plates\Template($engine);
// set devmode
$template->dev = $devmode;
// activePlayer
$activePlayer = $redis->get('activePlayer');
// TODO: rework needed
$template->activePlayer = $activePlayer;
// allowed controllers
$controllers = array('credits', 'coverart', 'dev', 'debug', 'help', 'index', 'login', 'mpd', 'network', 'playback', 'settings', 'sources', 'tun');
// check page
if (in_array($template->uri(1), $controllers) or empty($template->uri(1))) {
    // decode REQUEST_URL and assing section
    if (!empty($template->uri(1)) && $template->uri(1) !== 'playback') {
        // decode ACTION
        if (!empty($template->uri(2))) {
            $template->action = $template->uri(2);
Example #3
0
 /**
  * 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);
 }