Description Shows Instead of Title

Permalink Browser Info Environment
Hi Jordan,

Love the Fancybox, but I have a minor issue. The file Description displays on photos instead of the Title. I have a Description on some photo files because the slideshow add-on I use takes advantage of both. For the photos without Descriptions the Title displays correctly, so somehow Descriptions override Titles. Is there a fix for this?

Thanks
Spencer

Type: Discussion
Status: New
SpencerC
View Replies: View Best Answer
jordanlev replied on at Permalink Best Answer Reply
jordanlev
So you want it to always show the title and never the description?

You can alter the block's controller.php file (in packages/sortable_fancybox_gallery/blocks/sortable_fancybox_gallery/controller.php), replace this line:
$image['description'] = htmlspecialchars($fv->getDescription(), ENT_QUOTES, 'UTF-8');

...with this:
$image['description'] = htmlspecialchars($fv->getTitle(), ENT_QUOTES, 'UTF-8');


If that's not exactly what you're looking for and you need more fine-grained control over individual images, I have a paid addon called "Deluxe Image Gallery" that is similar on the front-end to Sortable Fancybox but has more back-end editing options to set specific titles and descriptions.
SpencerC replied on at Permalink Reply
SpencerC
This worked. Thanks!
jordanlev replied on at Permalink Reply
jordanlev
Oh, hey Spencer! I didn't realize that was you when I originally replied (brain was kind of fried a few weeks ago). Glad it worked out -- as always feel free to get in touch with any other questions or issues.

-Jordan
SpencerC replied on at Permalink Reply
SpencerC
Thanks Jordan. I'd like it to display both, so my guess is that I would add the getTitle code to the area above getDescription, yes?

Thx,

-Spence
jordanlev replied on at Permalink Reply
jordanlev
Just follow my instructions above -- replace one line with the other. Be careful because there's another line above it that looks similar, just make sure you're working with the one that starts with "$image['description']".
SpencerC replied on at Permalink Reply
SpencerC
Thanks. Will do.

-Spencer
Meje replied on at Permalink Reply
Meje
Hi Jordan.

I also want it to display the title PLUS the description.

The default code is:

$image['title'] = htmlspecialchars($fv->getTitle(), ENT_QUOTES, 'UTF-8');
$image['description'] = htmlspecialchars($fv->getDescription(), ENT_QUOTES, 'UTF-8');


I have replaced
$image['title'] = htmlspecialchars($fv->getTitle(), ENT_QUOTES, 'UTF-8');


as shown above, with'

$image['description'] = htmlspecialchars($fv->getTitle(), ENT_QUOTES, 'UTF-8');


But it still only shows one of them at a time - If both the title and description are filled in, it will only show the description. If the title is the only one filled in, it will only show it then.

How can get it to show both at once?
Meje replied on at Permalink Reply 1 Attachment
Meje
Id also like to change the yellow pop up when you hover over the thumbnail in the gallery.

It currently picks up the entire description - but it needs to just state the Title.

Where can I change this?

- Ive attached a screen shot
jordanlev replied on at Permalink Reply
jordanlev
Edit the file SITEROOT/packages/sortable_fancybox_gallery/blocks/sortable_fancybox_gallery/view.php, and find this line:
<a href="<?php echo $img['full_src']; ?>" rel="<?php echo $rel; ?>" title="<?php echo $img['description']; ?>">

...and change it to this:
<a href="<?php echo $img['full_src']; ?>" rel="<?php echo $rel; ?>" title="<?php echo $img['title']; ?>">
jordanlev replied on at Permalink Reply
jordanlev
Keep these two lines the same:
$image['title'] = htmlspecialchars($fv->getTitle(), ENT_QUOTES, 'UTF-8');
$image['description'] = htmlspecialchars($fv->getDescription(), ENT_QUOTES, 'UTF-8');

...and below them, add this:
$separator = ' - '; //change this to what you want to put in between the title and description (could be just a space, or a colon, or a dash... whatever)
$image['title'] = $image['description'] = $image['title'] . $separator . $image['description'];
Meje replied on at Permalink Reply
Meje
Awesome! Thanks - worked perfectly!

I just need to figure out the yellow hover/popup now :) - Id like to remove it completely.
jordanlev replied on at Permalink Reply
jordanlev
Did you not see my other response, or did it not work for you?
Meje replied on at Permalink Reply
Meje
Opps, sorry, I thought they were 2 steps to getting the title to display along with the description, in the overlay.

No, it does not work. Ive just gone back in and played with it, and it is that line that controls it, but it also controls the title and discription in the overlay.

with line

<a href="<?php echo $img['full_src']; ?>" rel="<?php echo $rel; ?>" title="<?php echo $img['title']; ?>">


I took out the last 'title' in the code to see what it controls, and the yellow popup disappeared as well as the title and description in the overlay.
jamesleech replied on at Permalink Reply
jamesleech
Was needing this tweak and was very grateful for your clear posting. Good job.
hgstudio replied on at Permalink Reply
hgstudio
The summary on the Sortable Fancybox Gallery Home page instruct users to use the 'Title' Field in File Manager>[image]>'Properties' to update lightbox captions. This is incorrect, since the 'Description' field is actually being pulled. I suggest either changing the instructions or the Add-on code reflect how the Add-on actually works.
jordanlev replied on at Permalink Reply
jordanlev
Thank you for mentioning this -- not sure how I never noticed that typo before!
I have now updated the instructions to indicate that it's the "description" property that shows up in captions (not the "title").

Thanks again, and sorry for any confusion it may have caused.

-Jordan

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.