I am still getting used to BOLT.. nearing the completion of my first project.
I have a page that has multiple entries, but some of those entries have multiple images... ie:
sudo code...
<text text text> <img>
<img> <text text text> <img>
<text text text>
I am trying to figure out the best way to go about putting this content into BOLT, then serving it to the public.
I have read about imagelist:
Imagelist
The imagelist fieldtype is accessible as an array. This is convenient for most cases, because this makes it easy to output them as lists in your HTML. This simple example for an imagelist field named ‘slider’ will output thumnbails for each of the images, with links to the full sized versions.
- Code: Select all
{% for image in page.slider %}
<a href="{{ image.filename|image }}" title="{{ image.title }}">
<img src="{{ image.filename|thumbnail(100,100) }}">
</a>
{% endfor %}
The next example outputs a wrapping div and an unordered list, but only if the list actually contains elements. The first and last item in the list also get a custom ‘first’ and ‘last’ class added to them.
- Code: Select all
{% if page.slider|length > 0 %}
<div class='imageslider'>
<ul>
{% for image in page.slider %}
<li class="{% if loop.first %}first {% endif %}{% if loop.last %}last {% endif %}">
<img src="{{ image.filename|thumbnail(320,240) }}" alt="{{ image.title }}">
</li>
{% endfor %}
</ul>
</div>
{% endif %}
However, I guess I don't quite understand how to use it. Can someone tell me how I'd grab one of the images in the image list to use at a certain part of the entry?
Thanks,
Donovan