coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: oren99 on April 30, 2007, 10:54:39 AM

Title: remove albums description from the index and add it to the album view?
Post by: oren99 on April 30, 2007, 10:54:39 AM
for every album i have a long description and i want it to show only when i view the actual album.
right now its the other way around: i can see the description in the index (the list of all albums) but when i click on an album the description is not showing.
i managed to remove the description from the index by removing the row: "<p>{ALB_DESC}</p>" from the template.
i cant find now how to add it to the album view.
can someone help please?
i'n using the tentacle template. my website is: http://www.show-car.net (http://www.show-car.net)

thanks a lot
Title: Re: remove albums description from the index and add it to the album view?
Post by: Gizmo on April 30, 2007, 06:19:30 PM
I've created a couple of themes that use a concatenated album description on the main category page and then use the full description when viewing the albums. You can check out this link to a demo theme to see what I mean - http://coppermine-gallery.net/demo/cpg14x/index.php?theme=chaoticsoul (http://coppermine-gallery.net/demo/cpg14x/index.php?theme=chaoticsoul). Here's the link to the Chaoticsoul thread - http://forum.coppermine-gallery.net/index.php?topic=39753.0 (http://forum.coppermine-gallery.net/index.php?topic=39753.0).

If you just want to have the description showing when viewing albums here are the instructions:

Add this line after the define section of your theme.php file
$album_desc = get_album_desc($_GET[album]);

Add {$album_desc} somewhere in $template_thumb_view_title_row such as:

// HTML template for title row of the thumbnail view (album title + sort options)
$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td width="100%" class="alblink"><h2>{ALBUM_NAME}</h2></td>

                        </tr>
                        <tr><td>
                        <p>{$album_desc}</p>
                        </td></tr>
                        </table>

EOT;


Now you will see the description under the album title.
Title: Re: remove albums description from the index and add it to the album view?
Post by: oren99 on May 01, 2007, 11:11:12 AM
thanks a lot!
only thing is i didnt understand where to add the first line. what is the define section?
Title: Re: remove albums description from the index and add it to the album view?
Post by: Gizmo on May 01, 2007, 12:37:13 PM
In the Tentacle theme.php file after the below code. See where is says "define"?


  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.3
  $Source: /cvsroot/coppermine/stable/themes/fruity/theme.php,v $
  $Revision: 1.14 $
  $Author: gaugau $
  $Date: 2005/11/28 07:43:00 $
**********************************************/

// ------------------------------------------------------------------------- //
// The theme "Fruity" has been done by GauGau (http://gaugau.de/) based on   //
// the framed template of studicasa.nl (their website has gone down, so I    //
// guess no one will care). The usage of this theme is free for personal     //
// use, not for commercial use (according to the disclaimer of studiocasa)!  //
// ------------------------------------------------------------------------- //

define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_HAS_NAVBAR_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);  // Remove this if you edit this template until
                                            // you have validated it. See docs/theme.htm.
Title: Re: remove albums description from the index and add it to the album view?
Post by: oren99 on May 01, 2007, 01:07:13 PM
i did it exactly as you said and my site stop working.
when i enter my site i got a white blank page.
when i removed this line the site was viewable again.

what do you think i should do?
Title: Re: remove albums description from the index and add it to the album view?
Post by: Nibbler on May 01, 2007, 02:00:19 PM
You need to define get_album_desc() in theme.php


// Get the name of an album

function get_album_desc($aid)

{

    global $CONFIG;

    global $lang_errors;

    $result = cpg_db_query("SELECT description from {$CONFIG['TABLE_ALBUMS']} WHERE aid='$aid'");

    $count = mysql_num_rows($result);

    if ($count > 0) {

        $row = mysql_fetch_array($result);

        return $row['description'];

    } else {

        return "Album not found";

    }

}


Gizmo: You should cast $aid as an integer before you use it in the query for security.

$aid = (int) $aid;
Title: Re: remove albums description from the index and add it to the album view?
Post by: oren99 on May 01, 2007, 02:33:05 PM
Thank you very much Nibbler, its working fine now :)
Title: Re: remove albums description from the index and add it to the album view?
Post by: Gizmo on May 01, 2007, 03:25:04 PM
Dang, sorry I forgot to add the function to the above post. Thanks for the input Nibbler, I'm still learning (and sometimes the hard way).