0.0.6 • Published 11 years ago

phiz v0.0.6

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

Pure PHP Template Engine

Demo

Quick Start

index.php

<?php
require_once 'phiz/View.class.php';
$dir = dirname(__FILE__);
PhizView::setTemplateDir($dir . '/template');
PhizView::setMapDir($dir . '/map');
//init page and display
PhizView::page('foo-bar:page/Index.class.php')->display();

PhizView

a widget or block

source code (php style):

<?php

    //access permission
    $this->scope('private');

    //static resources
    $this->import('lib/jquery/jquery.js');
    $this->import('lib/bootstrap/bootstrap.css');
    
    //inputs
    $content = $this->input('content', 'hello world');

?>
<!-- html of view -->
<div><?php echo $content; ?></div>

source code (php class style)

<?php

class Foo_Widget_Bar extends PhizView
{

    protected function init()
    {
        //access permission
        $this->scope('private');
        
        //static resources
        $this->import('lib/jquery/jquery.js');
        $this->import('lib/bootstrap/bootstrap.css');
    }
    
    protected function loadTemplate()
    {
        //inputs
        $content = $this->input('content', 'hello world');
        $html  = '<!-- html of view -->';
        $html .= "<div>{$content}</div>";
        return $html;
    }
}

API Documentation

PhizView

PhizPage extend PhizView

Learn More