ride / web-template-smarty
Smarty template integration for the base web application of the Ride framework
Installs: 4 596
Dependents: 9
Suggesters: 0
Security: 0
Stars: 0
Watchers: 9
Forks: 0
Open Issues: 0
Requires
- nesbot/carbon: ^2.0
- ride/app: ^1.0.0
- ride/app-template: ^1.0.0
- ride/app-template-smarty: ^2.0.0
- ride/lib-common: ^1.0.0
- ride/lib-html: ^1.0.0
- ride/web: ^1.0.0
- ride/web-i18n: ^1.0.0
- ride/web-image: ^1.0.0
This package is auto-updated.
Last update: 2024-11-19 14:33:01 UTC
README
This module adds template blocks, functions and modifiers for a Ride application to Smarty.
Block functions
isGranted
Parse block content if the specified route/url/permission is allowed.
{isGranted permission="cms.node.varnish.manage"} ... {/isGranted}
Note: The content of this block is always rendered. If the content is used for logic, assign the grant to a var and use an if statement.
isNotGranted
Parse block content if the specified route/url/permission is not allowed.
{isNotGranted permission="cms.node.varnish.manage"} ... {/isNotGranted}
Note: The content of this block is always rendered. If the content is used for logic, assign the grant to a var and use an if statement.
Template functions
apiMethodParameters
{apiMethodParameters method= url= namespace= classes=}
apiType
{apiType type= url= method= html= link= namespace= classes=}
image
Return the URL of a transformed image.
⚠️ Transformations may require additional parameters.
For more information about the transformations and their parameters, check out ride-lib-image.
{image src=$content->image var='image' transformation='crop'}
parsley
Adds parsley data attributes to the attributes of a form widget.
{$widget = $formRow->getWidget()} {parsleyAttributes attributes=$widget->getAttributes() type=$widget->getType() var="attributes"}
tableVars
Add these FormTable variables to the template:
$tableNameField
$tableActionField
$tableIdField
$tableOrderField
$tableSearchQueryField
$tablePageRowsField
{tableVars}
translate
Translate a key using the i18n translator.
{translate key='label.submit' locale='nl'}
⚠️ When simply translating a key, using the {$key|translate}
modifier syntax is preferred.
url
Create an URL.
{url id='api.search' var='searchUrl'}
Modifiers
decorate
Common decorator IDs: storage.size
/ time
/ date.format
/ file
/ file.extension
/ file.size
{$content->data->getDatePublished()|decorate:'time'}
safe
Modify a string value to safely use it as a file name, URL, id etc.
{'Unsafe string!'|safe} {* result: unsafe-string *}
translate
{'label.fields.required'|translate}
Related Modules
- ride/app
- ride/app-image
- ride/app-template
- ride/app-template-smarty
- ride/lib-api
- ride/lib-image
- ride/lib-i18n
- ride/lib-router
- ride/lib-security
- ride/lib-template
- ride/lib-template-smarty
- ride/web
- ride/web-api
- ride/web-security
- ride/web-template
Installation
You can use Composer to install this application.
composer require ride/web-template-smarty