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: diffrent header images for categories and albums  (Read 6878 times)

0 Members and 1 Guest are viewing this topic.

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
diffrent header images for categories and albums
« on: December 16, 2013, 02:28:47 pm »

Is it possible to have a header image for category 1 and another header image for category 2?

same for albums thumbnails page.header image for album 1 diffrent for header image for album 2.

ex: thsis link http://www.allvip.us/cpg/test/thumbnails.php?album=1 to have a header image with a car and this link http://www.allvip.us/cpg/test/thumbnails.php?album=2 to have header image with a city.

is for my own gallery not for a theme so I am ok to edit coppermine files.

Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #1 on: December 16, 2013, 02:30:57 pm »

at least header image for all categories to be diffrent form header image for all albums.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: diffrent header images for categories and albums
« Reply #2 on: December 16, 2013, 02:49:42 pm »

Replace your current header image with a new token in your theme's template.html file and replace that token accordingly in theme.php.

I already did that for a gallery, unfortunately I currently have no access to its theme folder.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #3 on: December 16, 2013, 02:56:08 pm »

not like this: http://forum.coppermine-gallery.net/index.php/topic,76584.msg369543.html#msg369543

I want every album and every category to have another header image.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: diffrent header images for categories and albums
« Reply #4 on: December 16, 2013, 03:06:04 pm »

I understood your question, that's not the mod I meant. It's not publicly available, that's why I've currently no access.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #5 on: December 16, 2013, 03:31:48 pm »

I think I know how to solve: diffrent header image for all categories and all albums.Maybe a token in function cat list and another in function thumbnails.

I still have to find out how to have diffrent header image for every album and every category.

I will post how if I will find the solution.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: diffrent header images for categories and albums
« Reply #6 on: December 16, 2013, 03:56:28 pm »

a token in function cat list and another in function thumbnails.
That doesn't make sense. I already told you what to do. If you can wait some days I'll try to get access to the mod.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #7 on: December 16, 2013, 04:02:10 pm »

Thanks a lot.
Is no rush at all.I will wait.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: diffrent header images for categories and albums
« Reply #8 on: January 13, 2014, 04:32:56 pm »

Unfortunately our recent conversion is lost due to the site outage. If I remember correctly I posted a solution which adjusts the header image according to the category, for all following pages (thumbnail and intermediate-sized view).

Your preferred solution was to adjust the header image for the category and thumbnail pages separately and drop it for the intermediate-sized pages, correct? If so, I'll create the mod accordingly.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #9 on: January 14, 2014, 02:01:29 pm »

solution by ANDRE for different header images and logo images for each category only (not even for each thumbnails pages):

add this code to function pageheader before $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);(copy it from themes/sample/theme.php if is not in your theme.php)

ADD in your images foder header_1.jpg for cat=1,header_2.jpg for cat=2 etc and  logo_1.png for cat=1,logo_2.png for cat=2 etc and header_default.jpg for index.php.

Code: [Select]
    // header mod - start
    global $cat;
    $superCage = Inspekt::makeSuperCage();

    if ($superCage->get->getRaw('file') == 'minicms/cms') {
        $current_id = $superCage->get->getInt('id');
    } elseif (!$cat) {
        $current_id = 0;
    } elseif ($cat < 0) {
        $aid = -$cat;
        $current_id = mysql_result(cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '$aid' LIMIT 1"), 0);
    } else {
        $current_id = $cat;
    }

    $logo_file = 'themes/your_theme_name/your_images_folder/logo_'.$current_id.'.png';
    $header_file = 'themes/your_theme_name/your_images_folder/header_'.$current_id.'.jpg';

    $logo_link = file_exists($logo_file) ? '<a href="./index.php" title="Index" id="logo"><img src="'.$logo_file.'" alt="Index" /></a>' : '';
    $header_file = file_exists($header_file) ? $header_file : 'themes/your_theme_name/your_images_folder/header_default.jpg';

    $headerbar = <<<EOT
        <div class="headerbar" style="background:url('{$header_file}');">
            <div class="inner">
                <span class="corners-top"><span></span></span>
                <div id="site-description">
                    {$logo_link}
                </div>
                <span class="corners-bottom"><span></span></span>
            </div>
        </div>
EOT;
    $template_vars['{HEADERBAR}'] = $headerbar;
    // header mod - end


[Edit by André: Don't forget to add the token {HEADERBAR} to your theme's template.html file]
« Last Edit: January 20, 2014, 03:41:50 pm by Αndré »
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #10 on: January 14, 2014, 02:02:35 pm »

YES
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: diffrent header images for categories and albums
« Reply #11 on: January 20, 2014, 04:25:13 pm »

Updated code to use different header images for each category and album and don't use any header for intermediate-sized pages:

Code: [Select]
    // header mod - start
    global $cat, $CPG_PHP_SELF;

    if ($cat < 0) {
        $what = 'alb_';
        $current_id = -$cat;
    } else {
        $what = 'cat_';
        $current_id = $cat;
    }

    $logo_file = 'themes/your_theme_name/your_images_folder/logo_'.$what.$current_id.'.png';
    $header_file = 'themes/your_theme_name/your_images_folder/header_'.$what.$current_id.'.jpg';

    $logo_link = file_exists($logo_file) ? '<a href="./index.php" title="Index" id="logo"><img src="'.$logo_file.'" alt="Index" /></a>' : '';

    $header_file = file_exists($header_file) ? $header_file : 'themes/your_theme_name/your_images_folder/header_'.$what.'default.jpg';

    $headerbar = <<<EOT
        <div class="headerbar" style="background:url('{$header_file}');">
            <div class="inner">
                <span class="corners-top"><span></span></span>
                <div id="site-description">
                    {$logo_link}
                </div>
                <span class="corners-bottom"><span></span></span>
            </div>
        </div>
EOT;
    $template_vars['{HEADERBAR}'] = ($CPG_PHP_SELF == 'displayimage.php') ? '' : $headerbar;
    // header mod - end

As you can see I've added $what to the file name, this means you need corresponding files in your images folder, e.g.
  • header_cat_0.jpg
  • header_cat_1.jpg
  • header_cat_2.jpg
  • header_cat_3.jpg
  • header_cat_default.jpg
  • logo_cat_0.jpg
  • logo_cat_1.jpg
  • logo_cat_2.jpg
  • logo_cat_3.jpg
  • header_alb_1.jpg
  • header_alb_2.jpg
  • header_alb_3.jpg
  • header_alb_default.jpg
  • logo_alb_1.jpg
  • logo_alb_2.jpg
  • logo_alb_3.jpg
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: diffrent header images for categories and albums
« Reply #12 on: January 21, 2014, 12:05:36 am »

thanks a lot
Logged
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 20 queries.