Gallery not going back correctly from link [[+galitem.albums]]

Link should go back to gallery from galleryItem, but uses id of current page.
This is the link address

This is the correct link

I tried this in a custom chunk

 <span><a  [[+total:lt=`7`:then=`
     href="[[~13? &[[+albumRequestVar]]=`[[+id]]`]]"
     href="[[~17? &[[+albumRequestVar]]=`[[+id]]`]]" 


This does not work correctly because it does not know how many images in the album.
Unless ther is a way to pass that information to the image item page?
If nobody can give me an answer, I will have to use a backlink.

<button onclick="history.back()">Go Back</button>

Maybe you can pass this information with an additional request-parameter:

<!-- In then chunk "myGallery" -->
<a href="[[~16?
	&total=`[[+total]]` ]]">
<!-- or maybe like this -->
<a href="[[~16?
	&returnId=`[[*id]]` ]]">

Tried both examples , they add parameters to the url, but not the link to the Album.
If I could change the first part [[*id]]?

<span><a href="[[~[[*id]]? &[[+albumRequestVar]]=`[[+id]]`]]">[[+name]]</a></span>

It is ok if I am on the same page.

On the “Gallery Item” page, you then have to read this additional request parameter to generate the correct link back to the Gallery.

You can either read the value of a GET request parameter with the FastField syntax (if pdoTools is installed)


or you can use an extra like getUrlParam or a custom snippet.

Is this correct?


My myGalItemThumb chunk

    <a href="[[~16?
    <img src="[[+thumbnail]]" alt="[[+description]]" />

GalleryItem snippet

   <button onclick="history.back()">Go Back</button> 
Albums: [[+galitem.albums]]
[[!+galitem.image:notempty=`<img src="[[+galitem.image]]" alt="[[+galitem.description]]" />`]]

My myGalItemAlbum chunk

<span><a href="[[~[[#GET.returnId]]? &[[+albumRequestVar]]=`[[+id]]`]]">[[+name]]</a></span>

This worked thanks.
But I might use a backlink because each image belongs to 1 album.
Maybe I am approaching a solution the wrong way.
Just wanted it easy for the client just to create an album and that’s it.

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”.