Light Mode
Testimonials
This pre-defined component displays testimonials, which are feedback given by customers. The display order is set as per newest.
Following is the location of this component.
βββ src
βββ views
βββ components
| βββ home
| | ...
| | βββ testimonials.twig
...
Example
Variables
Usage
The file src\views\components\home\testimonials.twig
receives a list of testimonials
, which are the customers' feedbacks, in the form of a collection of items[]
,and then displays them inside a slider. The sorting of this collection is as per the newest.
In the following code we see how we can easily display the values of item.avatar
, item.name
, item.text
inside the slider uing for-loop. Also salla-button
is used here to navigate between previous slide
and next slide
.
<h2>{{ trans('blocks.home.testimonials') }}</h2>
{% for item in items %}
<img src="{{ item.avatar }}" alt="{{ item.name }}"/>
<p>{{ item.text }}</p>
<div>
<h4>{{ item.name }}</h4>
</div>
<div>
{% for i in range(0, item.stars) %}
<i>*</i>
{% endfor %}
</div>
{% endfor %}
Last modified: 10 months ago