Hello
Have some questions with the pimcore image galley.
Have you to render this in output?
and how you get data to front-end?
Thanks and best regards
Hello
Have some questions with the pimcore image galley.
Have you to render this in output?
and how you get data to front-end?
Thanks and best regards
Hi @sandra-walker,
Here’s an example with Twig. First pass your object(s) containing the image gallery to the view.
public function myControllerAction()
{
// Fetch your objects here ...
return $this->renderTemplate('PathTo/view.html.twig', [
'objects' => $objects,
]);
}
Then you can render the images in your view like so, for example:
{% if objects is iterable and objects is not empty %}
<div>
{% for object in objects if object.imageGallery is not empty and object.imageGallery.items|length > 0 %}
<div>
{% for image in object.imageGallery.items %}
{{ image.thumbnail('my-thumbnail-config').html()|raw }}
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
Hope this helps!
Thanks for the effort… never used twig. Only PHP
Should work the same with PHP, just different syntax.
Protip: You should change to Twig, it waaaaay better.
Why another template engine?
PHP is great! Thanks aaron! Give it a try.
Cause you can do dirty things in PHP where no business logic should be. And trust me, if people have the chance to make business logic in a template, they do
And cause the php engine has been deprecated by symfony