forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: nickelas on August 10, 2011, 01:00:48 pm
-
I would like to put the keywords as links always showing above or below the intermediate picture (just like the file information but a bit more visible and without the other info). Is there any way of grabbing the linked keywords (and then assign them to a token)?
Thanks
Bilder av Uppsala (http://uppsalafoto.se/galleri/)
-
You could use this code from displayimage.php to create the keyword links:
if ($CURRENT_PIC_DATA['keywords'] != '') {
if ($CONFIG['keyword_separator'] == ' ') {
$info[$lang_common['keywords']] = '<span class="alblink">'
. preg_replace("/([^{$CONFIG['keyword_separator']}]+)/"
, '<a href="thumbnails.php?album=search&keywords=on&search=$1">$1</a>'
, $CURRENT_PIC_DATA['keywords'])
. '</span>';
} else {
$keyword_links = '';
foreach (explode($CONFIG['keyword_separator'], $CURRENT_PIC_DATA['keywords']) as $keyword) {
$keyword_links .= ($keyword_links ? ' '.$CONFIG['keyword_separator'].' ' : '')
. '<a href="thumbnails.php?album=search&keywords=on&search='
. str_replace(' ', '+', $keyword)
. '">' . $keyword . '</a>';
}
$info[$lang_common['keywords']] = '<span class="alblink">'
. $keyword_links
. '</span>';
}
}
-
Thanks!
So if anyone else is interested I put the code above in theme_html_picture. Then assigned a var to $info[$lang_common['keywords']], and put that var in a token in template_display_media
If I knew how to code plugins I'd do it that way but the hack above appears to be working :)