coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: lordprodigy on February 25, 2005, 08:09:16 PM

Title: Lastalb caption question
Post by: lordprodigy on February 25, 2005, 08:09:16 PM
Right now I have the album name and date underneath the thumbnail for each album shown in the lastalb breadcrumbs. I would like to add a line on top of the album name with the CATEGORY. in other words I would like to see a result which shows for example

Architecture
Building XYZ
March 2, 2005

Does anyone know how to do it?

Thanks in advance.
Title: Re: Lastalb caption question
Post by: Abbas Ali on February 26, 2005, 06:29:08 AM
Edit include/functions.inc.php

Find (Around line 825)


$result = db_query("SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid  FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $ALBUM_SET GROUP  BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit");


and replace with


$result = db_query("SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title, {$CONFIG['TABLE_ALBUMS']}.category AS category, {$CONFIG['TABLE_ALBUMS']}.aid AS aid  FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $ALBUM_SET GROUP  BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit");


Find (around line 829)


if ($set_caption) foreach ($rowset as $key => $row){
         $caption = "<span class=\"thumb_caption\">".$row['title']." - ".localised_date($row['ctime'], $lastup_date_fmt).'</span>';
         $rowset[$key]['caption_text'] = $caption;
}


and replace with


if ($set_caption) foreach ($rowset as $key => $row){
     if ($row['category'] > FIRST_USER_CAT) {
          $userId = $row['category'] - FIRST_USER_CAT;
          $result = db_query("SELECT user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_id = '$userId'");
          $row2 = mysql_fetch_array($result);
          $catName = $row2['user_name']."'s Gallery";
      } elseif ($row['category'] == 0) {
          $catName = "No Category";
      } else {
          $result = db_query("SELECT name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '".$row['category']."'");
          $row2 = mysql_fetch_array($result);
          $catName = $row2['name'];                           
      }
      $caption = "<span class=\"thumb_caption\">$catName<br />".$row['title']." - ".localised_date($row['ctime'], $lastup_date_fmt).'</span>';
      $rowset[$key]['caption_text'] = $caption;
}



Abbas
Title: Re: Lastalb caption question
Post by: Michael-CGC on February 26, 2005, 09:53:14 PM
Hi Abbas

In "random pictures" I like to have under the pictures, which album they belong to. Is it possible?

Fx.

Random pic
Janet Jackson (album name)

Thx
Title: Re: Lastalb caption question
Post by: lordprodigy on February 27, 2005, 02:54:18 AM
Abbas, thank you! worked beautifully! you can see it working on my site. Do you have any idea for my other question related to latalb I posted on the board? Thanks a lot!
Title: Re: Lastalb caption question
Post by: lordprodigy on January 30, 2006, 08:00:28 PM
How can this be done in 1.4.3 ? Thanks in advance!
Title: Re: Lastalb caption question
Post by: lordprodigy on January 30, 2006, 08:07:49 PM
do I change db_query to cpg_db_query ? is the rest of the code fine?
Title: Re: Lastalb caption question
Post by: Joachim Müller on January 30, 2006, 08:37:58 PM
please stop asking cpg1.4.x stuff on the cpg1.3.x board. Thread locked.