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: Changing picture order in specific album  (Read 11800 times)

0 Members and 1 Guest are viewing this topic.

Andy14

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Changing picture order in specific album
« on: September 26, 2006, 09:28:25 am »

Hi there - is it possible to change the order of individual pictures in a specific album? By default, I sort my pictures according to the date they were added; however, in one album, I wish to sort them by file name - how would one go about changing the order of pictures in only an individual album, whilst retaining their default setting for the rest of the gallery?
« Last Edit: September 29, 2006, 10:06:38 pm by Sami »
Logged

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: Changing picture order in specific album
« Reply #1 on: September 26, 2006, 01:00:33 pm »

well anything is possible off course and I can think of 2 solutions but you need to have some knowledge of php and well the solution will only work for that specific album so it's more a hack for this function.

But here the suggestion:

Since that specific album has an unique album id you can simply make an if statement using this to determine if this is the special album for showing it for instance if the aid = 43

Code: [Select]
if ($aid = 43) {
sql = SELECT * ............... ORDER BY `mtime` DESC
etc etc...
} else {
the normal query
}

A somehow nicer aproach and how I would do it is to add an extra colum in the album table and call this for instance mode you can for instance set it default to 0 and for the special albums to 1. than make a statement which checks for the value of mode

Code: [Select]
if ($mode = 1) {
sql = SELECT * ............... ORDER BY `mtime` DESC
etc etc...
} else {
the normal query
}

I don't know if this can help you since I don't know your skills in programming so let me know

In this case you will only have to edit your database for those very special occasions and can leave the sourcecode the same






Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

Andy14

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Changing picture order in specific album
« Reply #2 on: September 26, 2006, 02:55:41 pm »

Thanks for the wonderful suggestions! I'm "so-so" at PHP and MySQL - I know enough to get by, the the second method sounds best, as I don't need to modify the source code. I'm sorry for my ignorance, but would you be able to post the exact code/details I will need to add to the table in PHPMyAdmin? Thanks so much!
Logged

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: Changing picture order in specific album
« Reply #3 on: September 26, 2006, 03:17:24 pm »

the the second method sounds best, as I don't need to modify the source code.

well you still need to edit the source code but, I ment you dont have to edit the source code if you accidently want to add other albums in the future with the same feature.

so actually the second suggestion is more complicated
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: Changing picture order in specific album
« Reply #4 on: September 26, 2006, 03:45:07 pm »

Ok well quick and dirty solution

(not tested since I dont have coppermine at the office only the source codes but it should work )

find out what the album number is you want to have the special behaviour

Open functions.inc.php in a text editor

find at line @946

Code: [Select]
if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name';

$query = "SELECT $select_columns from {$CONFIG['TABLE_PICTURES']} WHERE ((aid='$album' $forbidden_set_string ) $keyword) $approved $ALBUM_SET ORDER BY $sort_order $limit";

change into (lets pretend the album has id 43
Code: [Select]
if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name';
if($album == 43) $sort_order = 'filename ASC';

$query = "SELECT $select_columns from {$CONFIG['TABLE_PICTURES']} WHERE ((aid='$album' $forbidden_set_string ) $keyword) $approved $ALBUM_SET ORDER BY $sort_order $limit";

In case you want the titles descending use if($album == 43) $sort_order = 'filename DESC';

In case you want to have more albums use something like

if ($album == .... || $album == ... || $album == ...) $sort_order = 'filename ...';



Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

Andy14

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Changing picture order in specific album
« Reply #5 on: September 29, 2006, 02:41:20 am »

Worked perfectly - thanks so much man, you're a life saver!
Logged

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: Changing picture order in specific album
« Reply #6 on: September 29, 2006, 06:16:41 pm »

Your welcome.

Topic can be closed.
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 20 queries.