Gallery is there a way to separate the links to templates?

I would like it if I click a galleryalbum it appears on a new resource with its own template.
Same with the individual pages.
This is the code I am using.
[[!GalleryAlbums?
&rowTpl=galAlbumRowWithCoverTpl
]]

<h2>Item</h2>

[[!GalleryItem]]
[[!+galitem.image:notempty=`
<div class="image">
  <a href="[[+galitem.image]]"><img class="[[+galitem.imgCls]]" src="[[+galitem.image]]" alt="[[+galitem.name]]" /></a>
  <br />Albums: [[+galitem.albums]]
  <br />Tags: [[+galitem.tags]]
</div>
`]]

<hr />

[[!Gallery? &toPlaceholder=`gallery`]]
<h1><a href="[[~[[*id]] &galAlbum=`[[+gallery.id]]`]]">[[+gallery.name]]</a></h1>
<p>[[+gallery.description]]</p>

[[+gallery]]

You probably have to use a custom chunk instead of “galAlbumRowWithCoverTpl”

and replace [[*id]] with the resource-ID where you want to show the album.

1 Like

Would I replace the id like this
[[~[[13]]

Just replace [[*id]] with the resource-ID → <a href="[[~13? &[[+albumRequestVar]]=`[[+id]]`]]">.

1 Like

That works.
Do I do the same thing with the gallery thumb to open a single image in a new page?
Do I alter galItemThumb?

Probably.

It seems you have to create another custom chunk and change [[*id]] to a fixed resource-ID again.

1 Like

Now I need to add a class to the first image in the Gallery.

      <div class="[[+cls]]">
      <a href="[[+linkToImage:if=`[[+linkToImage]]`:is=`1`:then=`[[+image_absolute]]`:else=`[[~[[*id]]?
            &[[+imageGetParam]]=`[[+id]]`
            &[[+albumRequestVar]]=`[[+album]]`
            &[[+tagRequestVar]]=`[[+tag]]` ]]`]]">
        <img class="[[+imgCls]]" src="[[+thumbnail]]" alt="[[+name]]" />
        </a>
        </div>

Can I use the +cls placeholder with output modifiers?

There is a placeholder [[+idx]] for the index of the image.
You could probably to something like this:

<div class="[[+cls]][[+idx:is=`0`:then=` first`]]">
1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.