Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Clickable keywords above or below intermediate image  (Read 2612 times)

0 Members and 1 Guest are viewing this topic.

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Clickable keywords above or below intermediate image
« 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
Logged
Human

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Clickable keywords above or below intermediate image
« Reply #1 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>';
        }
    }
Logged

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: Clickable keywords above or below intermediate image
« Reply #2 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 :)
Logged
Human
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.