comnect/smarty

smarty template engine for laravel4


Keywords
template, smarty, laravel
License
MIT

Documentation

smarty template engine for laravel4

This Project Has Been Deprecated

new Laravel.Smarty Project -> Laravel.Smarty

Build Status Latest Stable Version Total Downloads HHVM Status License

install 導入方法

for Laravel4.2

    "require": {
        "comnect/smarty": "2.*"
    },

for Laravel4.1

    "require": {
        "comnect/smarty": "1.*"
    },

Basic

smarty template for laravel4

laravel4でsmartyを使用できます。
bladeの構文をそのまま使用することができ、
それに加え、View Facadeを通じてsmartyのmethodはすべて利用可能です。
easily use all the methods of smarty

required array short syntax!

// laravel4 blade template render
View::make('template', ['hello']);
// use smarty method
View::assign('word', 'hello');  
View::clearAllAssign(); // smarty method

Artisan

キャッシュクリア、コンパイルファイルの削除がコマンドラインから行えます。
smarty's cacheclear, remove compile class from Artisan(cli)

cache clear

$ php artisan comnect:smarty-cacheclear

Options:
--file (-f) specify file
--time (-t) clear all of the files that are specified duration time

remove compile class

$ php artisan comnect:smarty-clear-compiled

Options:
--file (-f) specify file

usage 使い方

install後、 app/config配下のapp.phpのproviders配列に以下のnamespaceを追加してください。
add providers

'Comnect\Smarty\SmartyServiceProvider'

configファイルをpublishします。
publish configure

$ php artisan config:publish comnect/smarty

app/config/packages配下に追加されます。
publish to app/config/packages

views配下にsmartyファイルがあればそれをテンプレートと使用し、
なければ通常通りbladeテンプレートかphpファイルを使用します。

smartyテンプレート内にも{{app_path()}}等のヘルパーそのまま使用できます。
その場合、delimiterをbladeと同じものを指定しない様にしてください。

configファイルでこれらの指定が可能です。

sample

layout.sample
layout.extends.sample