2017 © Pedro Peláez
 

library smartyprovider

Smarty service provider for silex (not compiled templates_c, multiple assign variables)

image

phongdatgl/smartyprovider

Smarty service provider for silex (not compiled templates_c, multiple assign variables)

  • Wednesday, December 10, 2014
  • by phongdatgl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SmartyServiceProvider

SmartyServiceProvider sẽ tạo ra provider cho Silex, sử dụng [Smarty] (http://www.smarty.net) làm template thay thế cho twig, (*1)

Tham Số

  • smarty.class_path (string, optional): Path tới thư mục libs của Smarty., (*2)

  • smarty.options (array, optional): Options một số API của [Smarty] (http://www.smarty.net). Xem thêm: [Smarty documentation] (http://www.smarty.net/docs/en/api.variables.tpl), (*3)

Dịch Vụ

  • smarty: Sử dụng Smarty template enginer. Có tùy chỉnh phù hợp với Silex Application

Cài đặt

Đường dẫn của [Smarty] (http://www.smarty.net) tại vendor/Smarty . Hãy chắc chắn rằng nó tồn tại:, (*4)

use Phongdatgl\Smarty\ServiceProvider as SmartyServiceProvider;

define('APP_PATH', '/path/your/project');
$app->register(new SmartyServiceProvider(), array(
          //'smarty.dir' => APP_PATH . '/vendor/Smarty/', //có hoặc không. Không có thì app sẽ mặc định lấy từ vendor
          'smarty.options' => array(
                'template_dir' => APP_PATH . '/views',
                'caching'         => false,
                'force_compile'   => false,
                'use_sub_dirs'    => false)));

Sử dụng

Sử dụng trên silex, (*5)

$app->get('/hello/{name}', function ($name) use ($app) {
    $app['smarty']->assign('name', 'John Doe');
    return $app['smarty']->render('hello.tpl', array('age'=>15));
});

The Versions

10/12 2014

dev-master

9999999-dev https://github.com/phongdatgl/Silex_SmartyServiceProvider.git

Smarty service provider for silex (not compiled templates_c, multiple assign variables)

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

extension silex smarty silex-extension