Clickable keywords above or below intermediate image Clickable keywords above or below intermediate image
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Clickable keywords above or below intermediate image

Started by nickelas, August 10, 2011, 01:00:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nickelas

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
Human

ΑndrĂ©

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&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>';
        }
    }

nickelas

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 :)
Human