Lastalb caption question Lastalb caption question
 

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]

Main Menu

Lastalb caption question

Started by lordprodigy, February 25, 2005, 08:09:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lordprodigy

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.

Abbas Ali

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
Chief Geek at Ranium Systems

Michael-CGC

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

lordprodigy

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!

lordprodigy

How can this be done in 1.4.3 ? Thanks in advance!

lordprodigy

do I change db_query to cpg_db_query ? is the rest of the code fine?

Joachim Müller

please stop asking cpg1.4.x stuff on the cpg1.3.x board. Thread locked.