Hi! For me this works:
First make sure to add "imagelist" to your contenttypes.yml for pages:
- Code: Select all
imagelist:
type: imagelist
Bolt backend will ask you for rebuilding the database. Follow the instructions.
Now create a new page, there will be a new field for adding images to a list, add some images and publish.
Your page does now have a very sparse list of image-thumbnails. To make this more gallery-like, add some code to your record.twig template. Locate the line where the code block for imagelists begins, in base-2014 theme this is line 29. Replace the appropriate lines with this:
- Code: Select all
{% elseif record.fieldtype(key) == "imagelist" and value != "" %}
{# We do something tricky here: we need to get value of the list in the proper
way, so the value in actually returned as a list. Using {{ record.key }}
won't work, because there is no value 'key'. In your own templates you
will be able to use {{ record.yourfieldname }}. #}
{% set list = attribute(record, key) %}
<ul>
{% for item in list %}
<li class="{% if loop.first %}first {% endif %}{% if loop.last %}last {% endif %}">
<a class="fancybox" rel="gallery" href="{{ image(item.filename) }}">
<img src="{{ thumbnail(item.filename, 240,160) }}" alt="{{ item.title }}" title="{{ item.title }}">
</a>
</li>
{% endfor %}
</ul>
Note: you have to beautify this with css as you like. The first and last list-item will have a specific class, so that you can show first or last images larger than other thumbnails and let them float left or right.