2017 © Pedro Peláez
 

library laravel-smarty-view

Smarty template engine for Laravel 4

image

vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  • Thursday, December 18, 2014
  • by vincekovacs
  • Repository
  • 1 Watchers
  • 2 Stars
  • 76 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 1 Forks
  • 0 Open issues
  • 22 Versions
  • 0 % Grown

The README.md

Laravel 4 Smarty view

Smarty template engine for Laravel 4, (*1)

Table of content

Known issues

  • none

Back to top, (*2)

TODO

  • Fix incoming bugs
  • Finish documentation

Back to top, (*3)

Features

  • using smarty templates
  • using multiple template engines

Back to top, (*4)

Installation

To your composer.json file add following lines:, (*5)

// to your "require" object
"vi-kon/laravel-smarty-view": "1.*"

In your Laravel 4 project add following lines to app.php:, (*6)

// to your providers array
'ViKon\SmartyView\SmartyViewServiceProvider',

Back to top, (*7)

Usage

Simply create new template file with .tpl extension and load with View class., (*8)

\View::make('route/to/template/file')
     ->with("param", null);

On extending or loading another smarty template need path prefix with view:path., (*9)

{extends file="view:layout-site"}
...

Back to top, (*10)

Config file

On custom config easily publish it with php artisan config:publish vi-kon/laravel-smarty-view command. The command will create new file app/config/packages/vi-kon/laravel-smarty-view/config.php. The file need to move to app/config/packages/vi-kon/smarty-view/config.php location., (*11)

config.php content:, (*12)

return array(
    // Enable or disable caching
    'caching'         => false,
    // Enable or disable debugging
    'debugging'       => false,
    // Set cache lifetime
    'cache_lifetime'  => 3600,
    // Check compile
    'compile_check'   => true,
    // Set error reporting level in Smarty templates
    'error_reporting' => null,

    // Template directory
    'template_dir'    => app_path() . '/views',
    // Cache directory
    'cache_dir'       => app_path() . '/storage/views/cache',
    // Compile directory
    'compile_dir'     => app_path() . '/storage/views/compile',

    // Plugins directory
    'plugins_path'    => array(),
);

Back to top, (*13)

Events


Back to top, (*14)

smarty-view.init

Firring, when SmartyView is constructed, to add custom configuration options., (*15)

Attributes

Type Name Description
Illuminate\Config\Repository options Is alias for \Config object

Usage

Example usage in package service provider:, (*16)

public function boot()
    \Event::listen('smarty-view.init', function ($config)
    {
        $config->set('smarty-view::plugins_path', array_merge(
            $config->get('smarty-view::plugins_path'),
            array(__DIR__ . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . 'plugins')));
    });
}

Back to top, (*17)

Custom plugins

Avalaible custom plugins:, (*18)

Auth check

The auth_check tag is alias for:, (*19)

return Auth::check();

Back to top, (*20)

Return value is type of boolean., (*21)

Auth user

The auth_user tag is alias for (if no assign attribute provided):, (*22)

return Auth::getUser();

Return value is type of UserInterface or null., (*23)

Attributes

Type Name Description Required Default
string assign Assign user data to named variable instead return - -

Back to top, (*24)

Config

The config tag is alias for:, (*25)

return Config::get($key, $default);

Return value is type of mixed., (*26)

Attributes

Type Name Description Required Default
string key Config variable key x -
mixed default Default value if config key not exists - -

Usage

{config key="app.locale"}

Back to top, (*27)

Datatable

The datatable block tag is for chumper/datatable Laravel 4 package to make datatables., (*28)

Plugin can load localization (language) data from lang\{local}\datatable.php. If language file not exists datatables default localization data will be used., (*29)

Attributes

Type Name Description Required Default
string url Full URL for AJAX data - -
string action Route name for AJAX data - -
boolean searching Enable or disable searching - true
boolean lengthChange - -
string class Add custom class to datatable - -
string view Custom view to render datatable - "datatable"

Usage

{datatable action="route name" class="table-own" searching=false lengthChange=false}

...

{/datatable}

Sample datatable.php language file:, (*30)

return array(
    'sEmptyTable'     => 'No data available in table',
    'sInfo'           => 'Showing _START_ to _END_ of _TOTAL_ entries',
    'sInfoEmpty'      => 'Showing 0 to 0 of 0 entries',
    'sInfoFiltered'   => '(filtered from _MAX_ total entries)',
    'sInfoPostFix'    => '',
    'sInfoThousands'  => ',',
    'sLengthMenu'     => 'Show _MENU_ entries',
    'sLoadingRecords' => 'Loading...',
    'sProcessing'     => 'Processing...',
    'sSearch'         => 'Search:',
    'sZeroRecords'    => 'No matching records found',
    'oPaginate'       => array(
        'sFirst'    => 'First',
        'sLast'     => 'Last',
        'sNext'     => 'Next',
        'sPrevious' => 'Previous',
    ),
    'oAria'           => array(
        'sSortAscending'  => '=> activate to sort column ascending',
        'sSortDescending' => '=> activate to sort column descending',
    ),
);

Back to top, (*31)

Datatable column

Add column to Datatable. Have to declared in {datatable} block, otherwise it won't work., (*32)

Attributes

Type Name Description Required Default
string label Column label x -
string token Column label token for translator x -
boolean sortable Enable or disable column sorting - true
boolean orderable Enable or disable column sorting (alias) - true
string width Column width - "auto"
string class Column class (individual td classes) - -
string type Column type (html, string, numeric, date) - "html"

Only either of label or token is required., (*33)

Usage

{datatable_column token="language/file.and.token" width="120px" sortable=false}

Back to top, (*34)

Form

The form block tag opens and closes form:, (*35)

return Form::open($params)
       . $content
       . Form::close()

Return value is type of string, with generated HTML form., (*36)

Attributes

All parameters passed to Form::open method as HTML attributes., (*37)

Usage

{form action="route name" class="form-horizontal" role="form"}

...

{/form}

HTML output:, (*38)

<form action="generated route from name" method="POST" accept-charset="UTF-8" class="form-horizontal" role="form">
    ...
</form>

Back to top, (*39)

Form checkbox

The form_checkbox is alias for Form::checkbox., (*40)

Return value is type of string, with generated HTML checkbox input field., (*41)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -
mixed _value checkbox value attribute - null
boolean _checked if true checkbox will be checked, otherwise not - false
boolean _populate if true old input data will be used - false

Usage

{form_checkbox _name="field-checkbox" _checked=true class="checkbox"}

Back to top, (*42)

Form file

The form_file is alias for Form::file., (*43)

Return value is type of string, with generated HTML file input field., (*44)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -

Usage

{form_file _name="field-file"}

Back to top, (*45)

Form hidden

The form_hidden is alias for Form::hidden., (*46)

Return value is type of string, with generated HTML hidden input field., (*47)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -
mixed _value hidden field value attribute - null
boolean _populate if true old input data will be used - false

Usage

{form_hidden _name="field-hidden" value="hidden-value"}

Form password

The form_password is alias for Form::password., (*48)

Return value is type of string, with generated HTML password input field., (*49)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -

Usage

{form_password _name="field-password"}

Back to top, (*50)

Form radio

The form_radio is alias for Form::radio., (*51)

Return value is type of string, with generated HTML radio input field., (*52)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -
mixed _value radio value attribute - null
boolean _checked if true radio will be checked, otherwise not - false
boolean _populate if true old input data will be used - false

Usage

{form_radio _name="field-radio" _checked=true class="radio"}

Back to top, (*53)

Form select

The form_select is alias for Form::select or Form::selectRange., (*54)

Return value is type of string, with generated HTML select field., (*55)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -
string _default radio value attribute - null
string[] _list select items as associative array - array()
mixed _selected selected index value - array()
boolean _range if true radio will be generated as select range - false
string _begin range start value if range is true ""
string _end range end value if range is true ""
boolean _populate if true old input data will be used - false

Usage

{form_select _name="field-checkbox" _list=$data}

```smarty {form_select _name="field-checkbox" _range=true _begin=5 _end=100 class="checkbox"}, (*56)


--- [Back to top](#laravel-4-smarty-view) ### Form text The `form_text` is alias for `Form::text`. Return value is type of `string`, with generated HTML text field. #### Attributes | Type | Name | Description | Required | Default | | -------- | ----------- | ------------------------------------------------- |:----------------:| --------- | | string | `_name` | HTML `name` attribute | x | - | | string | `_value` | text `value` attribute | - | `null` | | boolean | `_populate` | if `true` old input data will be used | - | `false` | #### Usage ```smarty {form_text _name="field-text" class="text"}

Back to top, (*57)

Form textarea

The form_textarea is alias for Form::textarea., (*58)

Return value is type of string, with generated HTML textarea field., (*59)

Attributes

Type Name Description Required Default
string _name HTML name attribute x -
string _value textarea value attribute - null
boolean _populate if true old input data will be used - false

Usage

{form_textarea _name="field-textarea" class="textarea"}

Back to top, (*60)

License

This package is licensed under the MIT License, (*61)


Back to top, (*62)

The Versions

18/12 2014

dev-master

9999999-dev https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

17/09 2014

v1.0.17

1.0.17.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

17/09 2014

dev-develop

dev-develop https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

22/08 2014

v1.0.16

1.0.16.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

20/08 2014

v1.0.15

1.0.15.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

14/08 2014

v1.0.14

1.0.14.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

21/07 2014

v1.0.13

1.0.13.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

21/07 2014

v1.0.12

1.0.12.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

22/06 2014

v1.0.11

1.0.11.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

18/06 2014

4.2.x-dev

4.2.9999999.9999999-dev https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

18/06 2014

v1.0.10

1.0.10.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

18/06 2014

4.1.x-dev

4.1.9999999.9999999-dev https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

17/06 2014

v1.0.9

1.0.9.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

16/06 2014

v1.0.8

1.0.8.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

14/06 2014

v1.0.7

1.0.7.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

12/06 2014

v1.0.6

1.0.6.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

12/06 2014

v1.0.5

1.0.5.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

11/06 2014

v1.0.4

1.0.4.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

08/06 2014

v1.0.3

1.0.3.0 https://github.com/vi-kon/laravel-smarty-view

Smarty template engine for Laravel 4

  Sources   Download

MIT

The Requires

 

by Kovács Vince

laravel smarty view

23/05 2014

v1.0.2

1.0.2.0

  Sources   Download

The Requires

 

by Kovács Vince

23/05 2014

v1.0.1

1.0.1.0

  Sources   Download

The Requires

 

by Kovács Vince

23/05 2014

v1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by Kovács Vince