ride / web-template-smarty
Smarty template integration for the base web application of the Ride framework
Installs: 5 008
Dependents: 9
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 0
Open Issues: 0
pkg:composer/ride/web-template-smarty
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: 2025-10-19 16:47:29 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.
| Parameter | Type | Description | 
|---|---|---|
| route | String | Path to check for allowance. | 
| url | String | URL to check for allowance. | 
| permission | String | Permission code to check for allowance. | 
| strategy | String | AND or OR when checking more then one of the above checks. | 
| var | String | Variable to assign the result to. (true if this block content will be printed, false otherwise) | 
{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.
| Parameter | Type | Description | 
|---|---|---|
| route | String | Path to check for allowance. | 
| url | String | URL to check for allowance. | 
| permission | String | Permission code to check for allowance. | 
| strategy | String | AND or OR when checking more then one of the above checks. | 
| var | String | Variable to assign the result to. (true if this block content will be printed, false otherwise) | 
{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.
| Parameter | Type | Description | 
|---|---|---|
| src | String | Source url or file for this image. | 
| default | String | Fallback for src parameter. | 
| transformation | String | Name of the transformation. | 
| var | String | Variable name to assign this URL to. | 
| thumbnail | --- | Deprecated | 
⚠️ 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.
| Parameter | Type | Description | 
|---|---|---|
| type | string | Type of the form row widget | 
| validators | Array | Validators of a form row | 
| var | String | Variable name to assign the updated attributes to. | 
{$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.
| Parameter | Type | Description | 
|---|---|---|
| key | String | Translation key. | 
| locale | String | Translation locale. | 
| n | Integer | Number of items for a translation that describes multiple items. | 
| var | String | Variable name to assign the translated key to. | 
{translate key='label.submit' locale='nl'}
⚠️ When simply translating a key, using the {$key|translate} modifier syntax is preferred.
url
Create an URL.
| Parameter | Type | Description | 
|---|---|---|
| id | String | Route ID. | 
| parameters | Array | Path arguments for the URL. | 
| query | Array | Query parameters. | 
| separator | String | Seperator for query parameters. (defaults to &) | 
| var | String | Variable name to assign the URL to. | 
| object | Boolean | Return URL Object instead of String. (defaults to false) | 
{url id='api.search' var='searchUrl'}
Modifiers
decorate
| Parameter | Type | Description | 
|---|---|---|
| String | ID of the decorator. | 
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
| Parameter | Type | Description | 
|---|---|---|
| Array | Variables to be replaced in the translation. | 
{'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