[WordPress] 外掛分享: Blade Engine

首頁外掛目錄 › Blade Engine
WordPress 外掛 Blade Engine 的封面圖片
20+
安裝啟用
尚無評分
3147 天前
最後更新
問題解決
WordPress 4.8+ v1.0.1 上架:2017-08-05

內容簡介

此外掛可將 philo/laravel-blade 加入及載入至 WordPress 安裝程式中。
它會載入兩個函數,使您可以在樣板中使用 Blade 渲染引擎,提升佈景主題的易讀性。

使用方法

此外掛增加了兩個函數:
- render_blade_view (void,輸出內容)
- get_rendered_blade_view (string)

這兩個函數的參數相同:
1. 視圖 (必填,字串)
2. 屬性 (選填,陣列)

安裝時,外掛會在您的佈景主題目錄中建立一個 "views" 資料夾。您可以在這裡放置以 .blade.php 為副檔名的模板檔案。
子資料夾也可以放置模板檔案。

範例

wp-contents/themes/your-theme/views/components/article.blade.php:
blade
@if($show_text)
{{ $text }}
@endif

wp-contents/themes/your-theme/functions.php:
php
<?php
render_blade_view('components.article', [
'show_text' => true,
'text' => 'Hello World!',
]);

在任何頁面執行此函數,將會輸出 "Hello World!"

Blade

Blade 是主要由 Laravel 使用的模板引擎。更多資訊請參考:https://laravel.com/docs/5.1/blade
此外掛支援 Laravel 5.1 中所有可用的指令。

授權

此檔案為 Blade Engine 的一部分。

Blade Engine 為自由軟體,您可以依據自由軟體基金會發行的 GNU 通用公共授權條款對其進行重新發佈和修改。
Blade Engine 沒有任何擔保,不提供任何明示或暗示的擔保,包括但不限於對適銷性或特定用途的適用性的暗示擔保。
有關更多細節,請參閱 GNU 通用公共授權條款。

可以在http://www.gnu.org/licenses/中取得 GNU 通用公共授權條款的副本。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Blade Engine」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin adds and loads philo/laravel-blade to your WordPress installation.
It loads two functions, which enable you to use the Blade render engine in your templates which make your themes better readable.
Usage
The plugin adds two functions:
– render_blade_view (void, echoes the content)
– get_rendered_blade_view (string)
Both functions take the same parameters:
1. view (required, string)
2. attributes (optional, array)
When installed, the plugin creates a “views” folder in your theme directory. This is where you put your blade templates (with the .blade.php extension).
The “views” folder may contain subfolders.
Example
wp-contents/themes/your-theme/views/components/article.blade.php:
blade
@if($show_text)
{{ $text }}
@endif
wp-contents/themes/your-theme/functions.php:
php
true,
'text' => 'Hello World!',
]);
When ran on any page, it will output “Hello World!”
Blade
Blade is a template engine which is mainly used by Laravel. More information here: https://laravel.com/docs/5.1/blade
This plugin supports all the directives which are available in Laravel 5.1.
License
This file is part of Blade Engine.
Blade Engine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation.
Blade Engine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Get a copy of the GNU General Public License in http://www.gnu.org/licenses/.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon