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

Title: Clickable keywords above or below intermediate image
Post 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/)
Title: Re: Clickable keywords above or below intermediate image
Post by: Αndré on August 10, 2011, 05:55:35 pm
You could use this code from displayimage.php to create the keyword links:
Code: [Select]
    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&amp;keywords=on&amp;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&amp;keywords=on&amp;search='
                        . str_replace(' ', '+', $keyword)
                        . '">' . $keyword . '</a>';
            }
            $info[$lang_common['keywords']] = '<span class="alblink">'
                . $keyword_links
                . '</span>';
        }
    }
Title: Re: Clickable keywords above or below intermediate image
Post by: nickelas on August 10, 2011, 10:51:18 pm
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 :)