I use Piwigo 2.5.1 with PHP 5.4.15
My picture_content.tpl contains this code:
<img src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()} alt="{$ALT_IMG}">
When the image is hovered I want it to display something like:
{GalleryName} Text
How can I do that?
Offline
use this variable :
{$GALLERY_TITLE}
ps: it's the "title" attribute which need to be assigned
Offline
Didnt help.
My code:
<img src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()} title="{$GALLERY_TITLE}" alt="{$GALLERY_TITLE}">
Output:
<img width="1200" height="2105" alt="" title="" src="../../../_data/i/upload/2013/02/19/37373-me.jpg">
Last edited by jimaek (2013-05-18 00:55:27)
Offline
well that's unexpected
don't you have a
$conf['gallery_title']
in your local configuration ? (local/config/config.inc.php)
Offline
No. config_default.inc.php doesnt have that either.
What I should add?
Offline
Nothing, the problem would be if you had
$conf['gallery_title'] = '';
can we have the link of your gallery ?
Offline
I sent you a PM with the link.
Offline
well I don't know
your file .../themes/simplengnew/template/picture_content.tpl is good
and the same var is used in ../themes/simplengnew/template/header.tpl successfully
Offline
Oh I have an idea, try create a personal plugin with this content
add_event_handler( 'render_element_content', 'add_gallery_title_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL-10 ); function add_gallery_title_picture_content($content) { global $template, $page, $conf; $template->assign( 'GALLERY_TITLE', isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'] ); return $content; }
Offline
Nice, it works.
But it gives me the title of the website now. But do I make to add the name of the gallery in which the image resides?
Example:
Home/Birds/Big Birds/Picture 1
Picture 1 would have title/alt equal to "Big Birds"
Offline
ok, we call this an album, not a gallery (the gallery is the whole site)
you can use
<img src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()} title="{$SECTION_TITLE|strip_tags} - {$current.TITLE|@replace:'"':' '}" alt="{$ALT_IMG}">
and you don't need the personal plugin anymore
but this displays the full bread crumb
Last edited by mistic100 (2013-05-18 19:07:22)
Offline
Can I save the breadcrumb in a variable and do regex on it? And then display the result in the title?
Im still not sure how smarty works.
Offline
Ok, trying to do this:
title="{$SECTION_TITLE|strip_tags|regex_replace:"^([^-]*)/ ":" "} - {$current.TITLE|@replace:'"':' '}"
But I get:
Warning: preg_replace(): Unknown modifier '-' in /home/www/include/smarty/libs/plugins/modifier.regex_replace.php on line 32
According to http://gskinner.com/RegExr/ my regex is correct and works
^([^-]*)/
Offline
I did it!
The final code:
<img src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()} title="{$SECTION_TITLE|strip_tags|regex_replace:'/(.*)\/ /i':''} - {$current.TITLE|@replace:'"':' '}" alt="{$ALT_IMG}">
Thank for the help
Offline