Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fouber/phiz

Pure PHP Template Engine
https://github.com/fouber/phiz

Last synced: 5 days ago
JSON representation

Pure PHP Template Engine

Awesome Lists containing this project

README

        

Pure PHP Template Engine
=======

## Demo

* [phiz-demo](https://github.com/fouber/phiz-demo)

## Quick Start

index.php

```php
display();
```

## PhizView

> a widget or block

source code (php style):

```php
scope('private');

//static resources
$this->import('lib/jquery/jquery.js');
$this->import('lib/bootstrap/bootstrap.css');

//inputs
$content = $this->input('content', 'hello world');

?>


```

source code (php class style)

```php
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 .= "

{$content}
";
return $html;
}
}
```

## API Documentation

### PhizView

* [input($key, $default = null)](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L12-L15): get inputs
* [import($id)](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L3-L6): require static resources.
* [load($id)](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L21): load other view.
* [scope($type)](https://github.com/fouber/phiz-demo/blob/master/foo/widget/table/table.php#L3): define access permission.
* [css()](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L24): display required css resources.
* [js()](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L29): display required js resources.
* [startScript()](https://github.com/fouber/phiz-demo/blob/master/foo-bar/widget/left/left.php#L12): ob_start to collect script code.
* [endScript()](https://github.com/fouber/phiz-demo/blob/master/foo-bar/widget/left/left.php#L12): ob_get_clean to stop collecting script code.
* [script()](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L30): display collected script code.
* [display()](https://github.com/fouber/phiz-demo/blob/master/foo-bar/index.php#L11): echo rendered html
* [fetch()](https://github.com/fouber/phiz-demo/blob/master/foo-bar/page/Index.class.php#L21): return rendered html
* [getPageData($key, $default)](https://github.com/fouber/phiz-demo/blob/master/common/layout/skeleton/skeleton.php#L12): get data from the unique PhizPage instance.

### PhizPage extend PhizView

* [buildPage()](https://github.com/fouber/phiz-demo/blob/master/foo-bar/page/Index.class.php#L7-L22): abstract, return page rendered html.

## Learn More

* [sdk](https://github.com/fouber/phiz-tool)
* [demo](https://github.com/fouber/phiz-demo)