Php-angular/think-angular/php template engine and php template engine
I recently learned thinphp5 and found a useful template engine, think-angular,
This template engine has the following features: no additional tag definition is required, and all attributes are used for definition. The written template files are neat when the IDE formatting code, because the set template file is still standard html,
Note: Multiple Template commands can be used on a tag, and the commands must follow the order. Therefore, pay attention to the order of commands,
Project address: https://github.com/top-think/think-angular
Document address: https://www.kancloud.cn/shuai/php-angular/127397
<? Phpuse think \ angular \ Angular; require '.. /src/Angular. php '; $ data = ['title' => 'homepage', 'LIST' => [['id' => 1, 'name' => 'user _ 1', 'email '=> 'email _ 1@qq.com', 'status' => 1], ['id' => 2, 'name' => 'user _ 2', 'email '=> 'email _ 2@qq.com', 'status' => 0], ['id' => 3, 'name' => 'user _ 3', 'email '=> 'email _ 3@qq.com', 'status' =>-1], ['id' => 4, 'name' => 'user _ 4', 'email '=> 'email _ 4@qq.com', 'status' => 1], ['id' => 5, 'name' => 'user _ 5', 'email '=> 'email _ 5@qq.com ', 'status' => 1],],]; // tree structure $ menus = [['title' => 'menu 1 ', 'sub' => [['title' => 'menu 100'], ['title' => 'menu 100'], ['title' => 'menu 100'], ['title' => 'menu 100'], ['title' => 'menu 2 ', 'sub' => [['title' => 'menu 100'], ['title' => 'menu 100'], ['title' => 'menu 100'], ['title' => 'menu 100'], ['title' => 'menu 3 ', 'sub' => ['title' => 'dish Single 3.1 ', 'sub' => [['title' => 'menu 3.1.1'], ['title' => 'menu 3.1.2 '], ['title' => 'menu 3.1.3 ', 'sub' => [['title' => 'menu 3.1.3.1 '], ['title' => 'menu 3.1.3.2 '],], ['title' => 'menu 3.2'], ['title' => 'menu 100'], ['title' => 'menu 100'],],]; $ view-> assign ('pagecount ', 100); $ view-> assign ('P', isset ($ _ GET ['P'])? $ _ GET ['P']: 1); $ view-> assign ('page', function ($ p) {return 'index. php? P = '. $ p;}); // set data to the template engine $ view-> assign ($ data); $ view-> assign ('start _ time', $ start_time ); $ view-> assign ('menus', $ menus); // test php-model label transfer double quotation marks $ view-> assign ('name ', '"php" and "think-angular"'); // output the parsing result $ view-> display ('index '); // return the output result // $ html = $ view-> fetch ('index'); // echo $ html; // obtain the mixed code // $ php_code = $ view-> compiler ('index ');
PHP
<Div php-extends = "base"> </div> <div php-block = "main" class = "container"> <div class = "jumbotron"> Template