>, Tutorials>Gallery list function for custom templates

Gallery list function for custom templates

The Gallerylist function lets you to retrieve galleries for your custom pages. Infradox XS creates a variety of files in different sizes that you can use.
You can use the Gallery list function in your custom pages, for example your custom home page and custom gallery pages (57, 58 and 59).

Recommended reading

Using the Gallerylist function

The Gallerylist function retrieves galleries from your database using a number of parameters that you’ll need to specify. The Infradox software then builds the HTML output by looping through the resulting rows (galleries) and parsing the template that you have specified. There are 5 custom List templates that you can create in the code editor. You’ll find the List templates (page fragments) in the file dropdown, in the section Gallery list items (with id’s 151 up to 155).

Note that these page fragments are used to output HTML for gallery thumbnails, but these templates are not the same as the so called “slot” templates that are used in search pages, default gallery pages and lightbox related pages. Slot tags that are available in custom thumbnail templates can not be used in the gallery list templates.

If you want to create a custom gallery template that does use the normal thumbnail templates with e.g. add to cart/lightbox buttons et cetera, then you can use the templates Gallery page / Thumbnail slots (templates 54, 55 and 56) for this. Not any of the other custom gallery templates which use Gallery list item page fragments (151/155) exclusively.

Adding Gallerylist to your template

To use the Gallerylist() function in a page, simply add:

The function requires a number of parameters, as explained below:

  • listtemplate
    a number between 1 and 5 to specify which Gallery list item template you want to use
  • rootid
    either 0 or the id of the gallery manager root level from which you want to fetch galleries (0 for all)
  • groupid
    either 0 or the id of the gallery manager group from which you want to fetch galleries (0 for all)
  • orderby
    the sort order you want to use:

    • 0 – group title, gallery title
    • 1 – group title, gallery title descending
    • 2 – gallery title
    • 3 – gallery title descending
    • 4 – date
    • 5 – date descending
  • max – the maximum number of rows to fetch
  • offset – the number of rows to skip before parsing
  • needguid – specify value 1 to make sure only galleries for which a guid exists are returned

Note that which galleries are returned by the database call, can be affected by several things. For example the permissions of the user, whether or not galleries are published, which subdomain is active and so on.

The Offset parameter

The Offset parameter is used to skip a number of rows before parsing the HTML output. This can be used if for example you want to first retrieve one gallery to display it with a different layout, and then you want to retrieve four more to display using yet another layout. Note that if the max parameter must take the offset parameter into account. E.g. if you want to display 4 rows starting at the 2nd row in the dataset, then max must be 5 and offset must be 1.

For example:

And here’s an example of what list template 1 may look like:

The above example uses a 1000 pixel version of the gallery index file. You can change 1000_ to 750_ or 450_ for a 750 pixel version or a 450 pixel version. This is only possible for the files you have selected as the index file in Gallery manager (or that were selected by the software when creating a gallery automatically).

As shown in the example above, the list item templates use the gallerylist tag to output properties. For example:

2018-04-04T15:22:46+02:00 March 14th, 2017|Categories: Customisation, Tutorials|Tags: , , , |