WebsiteBaker Support (2.8.x) > Bakery Shop
Bakery Lightbox Caption with Email Link and Custom Subject
sky writer:
I have been working toward this functionality for some time now. I am building a website for an Art Gallery using Bakery as the gallery. It's working very well. Each work is shown as a thumbnail, and when clicked, opens using lightbox (actually fancybox, thanks to a great workaround by blackbird!). The caption below the lightbox image shows the Product Name ($img_title), which contains the artist's name, artwork title, dimensions etc.
To take the usability a step further, I wanted to add an "INQUIRE" link beside each caption so that when a user clicked, it would open their email with the Product Name info in the subject line. I found this functionality to put a hyperlink within a hyperlink on the lightbox site:
--- Code: ---$email_caption = '<a href="mailto:curator@quinnsoftweed.ca?subject=[TITLE]">Inquire</a>';
--- End code ---
Everything works perfectly except that most of the [TITLE] content has quotation marks and other symbols which break the functionality.
For instance: Alexis Arts "A Winters Walk" Oil 24x36"
Ends up in the Subject line as: Alexis Arts
I presume because the quotation mark is breaking something.
So I have been two days trying to learn about stripping slashes and string replacement, but nothing I have tried has worked.
If anyone can offer some guidance, it would be greatly appreciated. If I can get this working, I will gladly put up a tutorial for others to benefit from.
Here is the affected code from Bakery view_overview.php:
--- Code: ---$img_title = '[TITLE]';
$email_caption = '<a href="mailto:curator@quinnsoftweed.ca?subject=[TITLE]">Inquire</a>';
// Make array of all item thumbs and images
if (file_exists($thumb_dir.$thumb_file) && file_exists($img_dir.$image_file)) {
// If needed add lightbox2 link to the thumb/image...
if ($setting_lightbox2 == "overview" || $setting_lightbox2 == "all") {
$thumb_prepend = "<a href='".$img_url.$image_file."' rel='lightbox[image_".$item_id."]' title='".$img_title.$email_caption."'><img src='";
--- End code ---
Ruud:
You should use the php function htmlspecialchars of htmlentities for the title to replace all "problem" characters.
sky writer:
I've looked at those options but I can't find a way to make it work with my situation.
How do I use them to make the [TITLE] safe to use in the code as shown?
sky writer:
Thanks Ruud for pointing me in the right direction. I had tried those before, along with many other things. And I didn't work at that angle too much because I wasn't sure it was the right path. Once you told me that was the direction to go, it took some time, but I figured it out.
I will share all this when I get some time to formulate it into something understandable.
Cheers!
Bug:
I am curious about the fancybox in stead of lightbox, is this taken from a post on the forum?
Navigation
[0] Message Index
[#] Next page
Go to full version