Example #1
0
 public function __construct($options = [])
 {
     if (is_string($options)) {
         $this->options['path'] = $options;
         unset($options);
     }
     if (!empty($options)) {
         $this->options = array_merge($this->options, $options);
     }
     if (empty($this->options['path'])) {
         $this->options['path'] = self::DefaultPath;
     }
     // Apply configuration
     EmbeDi::fly()->apply($this->options, $this);
     // Setup view
     $this->view = new MiniView($this);
     $this->path = sprintf('%s/%s', Staple::fly()->getContentPath(), $this->options['path']);
 }
Example #2
0
<?php

use Maslosoft\Staple\Staple;
use Maslosoft\Staple\Request\HttpRequest;
// Include this file in http root's index.php, ie.:
// require __DIR__ . '/index.php';
// NOTE: This file might be overridden upon update
require __DIR__ . '/vendor/autoload.php';
echo Staple::fly(__DIR__)->handle(new HttpRequest());
Example #3
0
 public function setLayoutPath($layoutPath)
 {
     $this->staple->setLayoutPath($layoutPath);
 }