WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 19.06.2021 07:57:52

losttrip
Mitglied

Foldergallery: Modify caption text

What file would I edit to add a text link to the Caption on EVERY lightbox (fancybox) image?
e.g.
Current Caption = "This the the caption"

Desired Caption = "This is the caption - Click Here to go to Website"
"Click Here to go to Website" is the link text.

Offline

#2 19.06.2021 08:36:50

florian
Administrator

Re: Foldergallery: Modify caption text

Not sure if I'm getting you right. Does the link address differ, or is it also every time the same address?
In any case, you have to modify the file /modules/foldergallery/templates/view_Fancybox.htt, change

<a href="{LARGE_SRC}" data-fancybox="foldergallery" data-caption="{CAPTION}">

to

<a href="{LARGE_SRC}" data-fancybox="foldergallery" data-caption="{CAPTION} - <a href='https://www.example.com'>Click Here to go to Website</a>">

if it's always the same URL.
If it should point to different addresses, the most simple way to achieve this is to put just the target URL into the image description (but nothing more), e.g. the image description will be like "https://www.example.com", and to show the URL and the link, the mentioned line has to be changed to

<a href="{LARGE_SRC}" data-fancybox="foldergallery" data-caption="<a href='{CAPTION}'>{CAPTION} - Click Here to go to Website</a>">

If you need an image description AND an URL, I suggest to create a droplet for this and then call the droplet in the image description with the image text and the target URL as parameters.
In that case, you do not have to change the view_Foldergallery.htt. Just create a droplet named like "captionwithlink " with the content

return $text.' - <a href=\''.$link.'\' target=\'_blank\'>Click here to go to website</a>';

and then in the image description field of the foldergallery, enter

[[captionwithlink?text=this is the text&link=https://www.example.com]]

Beitrag geändert von florian (19.06.2021 08:46:13)


Code allein macht nicht glücklich. Jetzt spenden!

Offline

#3 24.06.2021 22:47:17

losttrip
Mitglied

Re: Foldergallery: Modify caption text

Thank you for your solutions.  They work as described.

What I was ultimately trying to do was to add the znip Merkzettel functionality into the caption.  Something like this:

<a href="{LARGE_SRC}" data-fancybox="foldergallery" data-caption="{CAPTION} - <a id='wish' class='wish_list_title' data-mmz='{CAPTION}'>Add to Wish List</a>">

But the znip Merkzettel doesn't seem to work from the fancybox lightbox caption.  When you click "Add to Wish List" nothing happens.

If I use the same znip code on the description page of the item, this is the source code, and it works:

<a id="wish" class="wish_list_title mmz_merkzettel_item" data-mmz="Item Title Text" title="Link Text">Link Text</a>

The source code for the link in the caption of the fancybox shows (this does not work):

<div class="fancybox-caption__body">Caption - <a id="wish" class="wish_list_title" data-mmz="Item Title Text">Link Text</a></div>

For some reason the "mmz_merkzettel_item" class is not being added to the fancybox caption link.

I've tried to figure out why, but I can't.

I'm sorry for the confusing explanation.  I can try to clarify if you have any questions.
Thank you.

Offline

#4 25.06.2021 07:54:39

florian
Administrator

Re: Foldergallery: Modify caption text

What you want to achieve is technically not possible. You have to find another solution.


Code allein macht nicht glücklich. Jetzt spenden!

Offline

#5 25.06.2021 13:51:08

losttrip
Mitglied

Re: Foldergallery: Modify caption text

Thank you.  I will.

Offline

Fußzeile des Forums

up