Git Product home page Git Product logo

think-blade's Introduction

Think-Blade

Blade template engine with thinkphp 5. (component & slot support)

Installation

composer require terranc/think-blade

conig.php:

'template'               => [
        // 模板引擎类型 支持 php think 支持扩展
        'type'         => 'Blade',
        // 模板路径
        'view_path'    => '',
        // 模板后缀
        'view_suffix'  => 'blade.php',
        // 模板文件名分隔符
        'view_depr'    => DIRECTORY_SEPARATOR,
        // 模板引擎普通标签开始标记
        'tpl_begin'    => '{{',
        // 模板引擎普通标签结束标记
        'tpl_end'      => '}}',
        'tpl_raw_begin'    => '{!!',
        'tpl_raw_end'    => '{!!',
        // 标签库标签开始标记
        'taglib_begin' => '{',
        // 标签库标签结束标记
        'taglib_end'   => '}',
    ],

Usage

<header id="navbar">
	<div class="row navbar-inner">
		<div class="col-xs-6 brand-block">
			<h4><a href="{{ url('/admin') }}"><img src="/assets/admin/images/logo.png"></a> · 管理后台
			</h4>
			<a href="javascript:;" class="cd_nav_trigger"><span></span></a>
		</div>
		<div class="col-xs-6 text-right user-block">
			你好,{{ $manage_user->nickname }}({{ $manage_user->username }})
			<span class="gap-line"></span>
			<a href="{{ url('/manage/index/account') }}" class="item">修改资料</a>
			<span class="gap-line"></span>
			<a href="{{ url('/manage/start/logout') }}" class="confirm item" title="确认要退出吗?">退出</a>
		</div>
	</div>
</header>

DOC

https://laravel.com/docs/5.4/blade

http://d.laravel-china.org/docs/5.4/blade (中文)

think-blade's People

Contributors

terranc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

think-blade's Issues

无法使用

未定义数组索引: cache

解决一个还有, 这是不维护了么

关于{!! !!} 不起作用

我想输入 分页标签内容;刚开始使用{{ }}会讲html源码输出到页面;使用{!! !!} 的话会连同标签整个输出;

a0db163e-498d-422f-9372-8ca46f2f1912
页面输出如下:
7bb3e913-2358-454f-aec9-46cae222a3b1

@php 标签无效果

大佬还有维护吗

@php
XXX
@endphp

@php 无效,变成直接输出里面的内容了

新建一个分支给5.1使用吧

Tp5.1 更新以后不能直接使用常量,Blade.php驱动里面配置需要修改成这样
'view_cache_path' => \think\facade\Env::get('runtime_path'). 'temp/',

兼容性问题

protected $config = [ // 视图基础目录(集中式) 'view_base' => '', // 是否开启模板编译缓存,设为false则每次都会重新编译 'tpl_cache' => true, // 模板起始路径 'view_path' => '', 'tpl_begin' => '{{', 'tpl_end' => '}}', 'tpl_raw_begin' => '{!!', 'tpl_raw_end' => '!!}', // 模板缓存目录 'view_cache_path' => RUNTIME_PATH . 'temp' . DS, // 模板文件后缀 'view_suffix' => 'blade.php', 'tpl_replace_string'=>'' ];
这段代码中‘view_cache_path’这个配置在php5.4.45中是不支持拼接常量的
虽然不清楚这个配置是干嘛的‘tpl_replace_string’,但是少了他会报错。我的是thinkPHP5.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.