Advanced search  

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

Pages: [1]   Go Down

Author Topic: Lastalb caption question  (Read 7517 times)

0 Members and 1 Guest are viewing this topic.

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Lastalb caption question
« 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.
« Last Edit: January 30, 2006, 08:38:17 pm by GauGau »
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Lastalb caption question
« Reply #1 on: February 26, 2005, 06:29:08 am »

Edit include/functions.inc.php

Find (Around line 825)

Code: [Select]
$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

Code: [Select]
$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)

Code: [Select]
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

Code: [Select]
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
Logged
Chief Geek at Ranium Systems

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Lastalb caption question
« Reply #2 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
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Lastalb caption question
« Reply #3 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!
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Lastalb caption question
« Reply #4 on: January 30, 2006, 08:00:28 pm »

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

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Lastalb caption question
« Reply #5 on: January 30, 2006, 08:07:49 pm »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Lastalb caption question
« Reply #6 on: January 30, 2006, 08:37:58 pm »

please stop asking cpg1.4.x stuff on the cpg1.3.x board. Thread locked.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.