.. include:: ../../Includes.rst.txt
.. _admin-manual-gallery:
Image gallery (example)
-----------------------
This chapter is an example on how you may extend this extension to be used as an
image gallery.
.. only:: html
.. contents::
:local:
:depth: 1
.. _admin-manual-gallery-extension:
Create a dedicated extension
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create an extension skeleton (e.g., ``my_gallery``) under
:file:`typo3conf/ext/my_gallery/`. You basically need two files:
- :file:`ext_emconf.php` (copy and adapt from another extension);
- :file:`ext_icon.png`.
Now we need to register an additional layout for the file list plugin, as
described in chapter :ref:`developer-manual-flexform-templateLayouts`.
Create file :file:`ext_localconf.php`:
.. code-block:: php
');
unset($boot);
We could add the few lines of TypoScript to our existing template but let do
that with a staticTS, as usual.
Create files :file:`ext_tables.php`:
.. code-block:: php
');
unset($boot);
and :file:`Configuration/TypoScript/setup.txt`:
.. code-block:: typoscript
plugin.tx_filelist {
view {
partialRootPaths.100 = EXT:my_gallery/Resources/Private/Partials/
}
}
.. _admin-manual-gallery-html:
Create the HTML of your gallery
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Yes, we are already nearly ready! Now we just need to create the HTML Fluid
template to be used with key "MyGallery".
Create file :file:`Resources/Private/Partials/MyGallery.html`:
.. code-block:: html
{file.properties.description}{file.properties.title}{file.name}
This is just an example of course! But it shows you how to get a
lightbox-enabled gallery of images with the FAL description or title (or even
file name) as fallback.
Have fun!
.. note::
By iterating over ``{folders}`` in addition to ``{files}`` your gallery would
support nested collections of images, based on folders. Just like that.
.. hint::
If you need to deal with a large list of images, you probably will want to
paginate it and you may find the `Paginate ViewHelper from Fluid Powered
TYPO3 `_
useful...