天天看點

php+代碼模闆下載下傳位址,簡單而強大的PHP模闆引擎

Simple and Powerful Template Engine for PHP.

Version 0.2

code

```php

include( 'forkTemplate.php' );

// まず、タグファイル(snippet)の場所と拡張子をセット

// first , set where tag files (snippet) are, and there extension.

$f = new forkTemplate( dirname( FILE ) . "/tags" , "tag" );

// そして、次にターゲットを決めます。これはメインテンプレートに、{@body}のように表記します。

// second , set target , which is written in main template file, like "{@body}"

$f->target( "body" );

// pタグで括るスニペットを使って、文字列をpタグで括ってみます。そしてテンプレートファイルのターゲットに差し込みます。

// wrap strings with

, using p.tag ( snippet file with

) and throw into target in main template.

$f->tag( 'p' )->val( "this is test");

// そして、レンダリングします。

// and then , render.

echo $f->render( " this is main template , and {@body} " );

// 入れ子もできます。

// you can nest tags ,

$f->tag( 'div' )->tag( 'p' )->v