Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: NoFollow for film strip  (Read 4041 times)

0 Members and 1 Guest are viewing this topic.

fotografi

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
NoFollow for film strip
« on: August 20, 2009, 10:10:30 am »

How to add the NoFollow tag only for the links of the film strip pics?

Regards.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: NoFollow for film strip
« Reply #1 on: August 20, 2009, 10:42:45 am »

You need to come up with a custom function for theme_display_film_strip. Edit themes/yourtheme/theme.php with a plain text editor and find that function. If it exists, edit as suggested below. If that function diesn't exist in your custom theme, copy
Code: [Select]
// Added to display film_strip
function theme_display_film_strip(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $pos, $sort_options, $mode = 'thumb')
{
    global $CONFIG, $THEME_DIR;
    global $template_film_strip, $lang_film_strip;

    static $template = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $spacer = '';

    if ((!$template)) {
        $template = $template_film_strip;
        $thumb_cell = template_extract_block($template, 'thumb_cell');
        $empty_cell = template_extract_block($template, 'empty_cell');
    }

    $cat_link = is_numeric($aid) ? '' : '&cat=' . $cat;
    $uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&uid=' . $_GET['uid'] : '';

    $thumbcols = $CONFIG['thumbcols'];
    $cell_width = ceil(100 / $CONFIG['max_film_strip_items']) . '%';

    $i = 0;
    $thumb_strip = '';
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}$uid_link",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => '',
                '{ADMIN_MENU}' => ''
                );
        }
        $thumb_strip .= template_eval($thumb_cell, $params);
    }

    if (defined('THEME_HAS_FILM_STRIP_GRAPHICS')) {
        $tile1 = $THEME_DIR . 'images/tile1.gif';
        $tile2 = $THEME_DIR . 'images/tile2.gif';
    } elseif (defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
        $tile1=$tile2=$THEME_DIR . 'images/tile.gif';
    } else {
        $tile1=$tile2= 'images/tile.gif';
    }

    $params = array('{THUMB_STRIP}' => $thumb_strip,
        '{COLS}' => $i,
        '{TILE1}' => $tile1,
        '{TILE2}' => $tile2,
        );

    ob_start();
    starttable($CONFIG['picture_table_width']);
    echo template_eval($template, $params);
    endtable();
    $film_strip = ob_get_contents();
    ob_end_clean();

    return $film_strip;
}
from themes/sample/theme.php into a new line before
Code: [Select]
?>of the file themes/yourtheme/theme.php

The edit you need to perform is:
find
Code: [Select]
                '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}$uid_link",and replace with
Code: [Select]
                '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}$uid_link" . '" rel="nofollow',Then find
Code: [Select]
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",and replace with
Code: [Select]
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}" . '" rel="nofollow',Haven't tested (just came up with the code out of the back of my head), but should work that way - please report. The nesting of single and double quotes that seems to be wrong is intended, please use exactly as I suggested.

In the future, respect board rules when asking questions: we want to you always post a link to your gallery when asking for support. Additionally, when asking for support on themeing, it's a good idea to zip your custom theme folder and attach the theme to your posting.
Logged

fotografi

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: NoFollow for film strip
« Reply #2 on: August 21, 2009, 10:26:47 am »

Your hack worked very well.   

Thank you very much.

But I'm afraid I'll need your help again :)

And I can't post the link of my website here due to it's adult content. Sorry!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: NoFollow for film strip
« Reply #3 on: August 21, 2009, 12:49:05 pm »

We have a strict "one issue per thread" that you agreed to respect when signing up. Locking.
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 19 queries.