Download the PHP package vi-kon/laravel-smarty-view without Composer
On this page you can find all versions of the php package vi-kon/laravel-smarty-view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vi-kon/laravel-smarty-view
More information about vi-kon/laravel-smarty-view
Files in vi-kon/laravel-smarty-view
Package laravel-smarty-view
Short Description Smarty template engine for Laravel 4
License MIT
Homepage https://github.com/vi-kon/laravel-smarty-view
Informations about the package laravel-smarty-view
Laravel 4 Smarty view
Smarty template engine for Laravel 4
Table of content
- Known issues
- TODO
- Features
- Installation
- Usage
- Config files
- Events
- smarty-view.init
- Custom plugins
- auth_check
- auth_user
- config
- datatable
- datatable_column
- form
- form_checkbox
- form_file
- form_hidden
- form_label
- form_password
- form_radio
- form_select
- form_submit
- form_text
- form_textarea
- html_script
- lang
- url
- url_current
- url_full
- License
Known issues
- none
Back to top
TODO
- Fix incoming bugs
- Finish documentation
Back to top
Features
- using smarty templates
- using multiple template engines
Back to top
Installation
To your composer.json
file add following lines:
In your Laravel 4 project add following lines to app.php
:
Back to top
Usage
Simply create new template file with .tpl
extension and load with View
class.
On extending or loading another smarty template need path prefix with view:path
.
Back to top
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.
config.php
content:
Back to top
Events
- smarty-view.init
Back to top
smarty-view.init
Firring, when SmartyView is constructed, to add custom configuration options.
Attributes
Type | Name | Description |
---|---|---|
Illuminate\Config\Repository |
options |
Is alias for \Config object |
Usage
Example usage in package service provider:
Back to top
Custom plugins
Avalaible custom plugins:
- auth_check
- auth_user
- config
- datatable
- datatable_column
- form
- form_checkbox
- form_file
- form_hidden
- form_label
- form_password
- form_radio
- form_select
- form_submit
- form_text
- form_textarea
- html_script
- lang
- url
- url_current
- url_full
Auth check
The auth_check tag is alias for:
Back to top
Return value is type of boolean
.
Auth user
The auth_user tag is alias for (if no assign
attribute provided):
Return value is type of UserInterface
or null
.
Attributes
Type | Name | Description | Required | Default |
---|---|---|---|---|
string | assign |
Assign user data to named variable instead return | - | - |
Back to top
Config
The config tag is alias for:
Return value is type of mixed
.
Attributes
Type | Name | Description | Required | Default |
---|---|---|---|---|
string | key |
Config variable key | x | - |
mixed | default |
Default value if config key not exists | - | - |
Usage
Back to top
Datatable
The datatable block tag is for chumper/datatable Laravel 4 package to make datatables.
Plugin can load localization (language) data from lang\{local}\datatable.php
. If language file not exists datatables default localization data will be used.
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
Sample datatable.php language file:
Back to top
Datatable column
Add column to Datatable. Have to declared in {datatable}
block, otherwise it won't work.
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.
Usage
Back to top
Form
The form block tag opens and closes form:
Return value is type of string
, with generated HTML form.
Attributes
All parameters passed to Form::open
method as HTML attributes.
Usage
HTML output:
Back to top
Form checkbox
The form_checkbox
is alias for Form::checkbox
.
Return value is type of string
, with generated HTML checkbox input field.
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
Back to top
Form file
The form_file
is alias for Form::file
.
Return value is type of string
, with generated HTML file input field.
Attributes
Type | Name | Description | Required | Default |
---|---|---|---|---|
string | _name |
HTML name attribute |
x | - |
Usage
Back to top
Form hidden
The form_hidden
is alias for Form::hidden
.
Return value is type of string
, with generated HTML hidden input field.
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 password
The form_password
is alias for Form::password
.
Return value is type of string
, with generated HTML password input field.
Attributes
Type | Name | Description | Required | Default |
---|---|---|---|---|
string | _name |
HTML name attribute |
x | - |
Usage
Back to top
Form radio
The form_radio
is alias for Form::radio
.
Return value is type of string
, with generated HTML radio input field.
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
Back to top
Form select
The form_select
is alias for Form::select
or Form::selectRange
.
Return value is type of string
, with generated HTML select field.
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
Back to top
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
Back to top
Form textarea
The form_textarea
is alias for Form::textarea
.
Return value is type of string
, with generated HTML textarea field.
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
Back to top
License
This package is licensed under the MIT License
Back to top