Lastalb caption question Lastalb caption question
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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.