Example #1
0
 public function execute()
 {
     //this is what happens when a view is executed
     $path = $this->_filePath;
     if ($this->_isWow) {
         $path = Wow::view($this->_filePath, App::layouts(), App::modules());
         if ($this->_version !== false) {
             $dot_pos = strrpos($path, '.', -5);
             $path = substr($path, 0, $dot_pos) . '.v' . $this->_version . '.php';
         }
     }
     FileManager::include($path);
 }
Example #2
0
namespace Application;

use xTend\Workbench\Workbench;
/**
 * Creates a new basic layout
 */
Workbench::register('^new:layout ([a-zA-Z0-9\\_\\.]+)$', function ($argv) {
    $name = $argv[1];
    $dot_pos = strrpos($name, '.');
    if ($dot_pos !== false) {
        $dir = Core\App::layouts()->directory(substr($name, 0, $dot_pos));
        if (!$dir->exists()) {
            $dir->create();
        }
    }
    $layout = Core\App::layouts()->file($name . '.wow.php', 2);
    if (Core\Wow::flavor() == Core\Wow::AT_SIGN) {
        $layout->write('<!DOCTYPE html>
<html>
    <head>
        @section:head
    </head>
    <body>
        @section:body
    </body>
</html>');
    } else {
        $layout->write('<!DOCTYPE html>
<html>
    <head>
        <section name="head" />
Example #3
0
        $view->write('@version:1
@compile:change+version');
    } else {
        $view->write('<version value="1" />
<compile value="change+version" />');
    }
}, 'new:view');
/**
 * Creates a new view which extends a layout
 */
Workbench::register('^new:view ([a-zA-Z0-9\\_\\.]+) ([a-zA-Z0-9\\_\\.]+)$', function ($argv) {
    $name = $argv[1];
    $dot_pos = strrpos($name, '.');
    // get and check layout
    $layout = $argv[2];
    if (!Core\App::layouts()->file($layout . '.wow.php', 2)->exists()) {
        die('Layout does not exist');
    }
    if ($dot_pos !== false) {
        $dir = Core\App::views()->directory(substr($name, 0, $dot_pos));
        if (!$dir->exists()) {
            $dir->create();
        }
    }
    $view = Core\App::views()->file($name . '.wow.php', 2);
    if (Core\Wow::flavor() == Core\Wow::AT_SIGN) {
        $view->write('@version:1
@layout:' . $layout . '
@compile:change+version');
    } else {
        $view->write('<version value="1" />