Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Change to lastup mainpage content window  (Read 4021 times)

0 Members and 1 Guest are viewing this topic.

PlymWS

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 11
Change to lastup mainpage content window
« on: March 13, 2007, 12:24:06 pm »

I would like to change the lastup window in the main index page.  Rather than have thumbnails for the last uploaded images I want to display a text list of the galleries created in the last 5 days or so.

I have tried to code this but can't get it to work.  Any ideas ?
« Last Edit: March 26, 2007, 06:19:16 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Change to lastup mainpage content window
« Reply #1 on: March 14, 2007, 07:25:26 am »

No pre-existing code to accomplish this. Instead, use anycontent and hard-code the links to the stuff in. Needs constant maintenance by you.
Logged

PlymWS

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 11
Re: Change to lastup mainpage content window
« Reply #2 on: March 14, 2007, 11:51:39 pm »

You can use the 'lastalb' setting to display a row of thumbnails for the last albums modified.  I just wondered if there was a way to time-limit these thumbnails e.g. only display updated galleries from the previous 5 days or so.
Logged

jaiak

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
  • Spanish
    • Spanish Young People Electronic Music and Concerts
Re: Change to lastup mainpage content window
« Reply #3 on: March 15, 2007, 02:27:35 am »

hello!

yo can make this with CPM Fetch, read this http://forum.coppermine-gallery.net/index.php?topic=35450.0

Regards from spain
Logged

PlymWS

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 11
Re: Change to lastup mainpage content window
« Reply #4 on: March 17, 2007, 12:42:31 pm »

Many thanks jaiak
Logged

PlymWS

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 11
Re: Change to lastup mainpage content window
« Reply #5 on: March 26, 2007, 12:22:46 pm »

Fetch doesn't really address what I want to do.  Or if it does, I couldn't see how to achieve it.

Looking at the code, I would have to modify the SQL calls to include a date < 5 days somewhere :

Code: [Select]
case 'lastalb': // Last albums to which uploads
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lastalb'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastalb'];
                }


                $META_ALBUM_SET = str_replace( "aid", $CONFIG['TABLE_PICTURES'].".aid" , $META_ALBUM_SET );

                $query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP  BY {$CONFIG['TABLE_PICTURES']}.aid";

                $result = cpg_db_query($query);
                $count = mysql_num_rows($result);
                mysql_free_result($result);

                $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' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('ctime'));

                $rowset = CPGPluginAPI::filter('thumb_caption_lastalb',$rowset);

                return $rowset;
                break;

I've tried modifying the $query statements to check the current date and the modification date to see if it's less that 5 days but I've had no luck.  Anyone think they know what I should modify the $queries to ?
Logged

PlymWS

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 11
Lastalb change required
« Reply #6 on: March 26, 2007, 01:16:39 pm »

I've posted a new thread to this because the last one was marked solved when it wasn't.

Basically I want the lastalb function to display only albums that were updated / uploaded in the last 5 days.  I've tried to modify the sql query to only select pictures where the mtime is 5 days or less but I keep getting a database error.

Here's what I've done so far :

code to create timestamp for 5 days ago :
Code: [Select]
$newdate = date("Y-m-d H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d")-5, date("Y")));
And inserted it into this query :
Code: [Select]
$query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND mtime <= ".$newdate." AND approved = 'YES' $META_ALBUM_SET GROUP  BY {$CONFIG['TABLE_PICTURES']}.aid";
This produces an error.  I've tried every combination I can think of but I can't get the sql query right.  Any ideas ?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Change to lastup mainpage content window
« Reply #7 on: March 26, 2007, 01:33:23 pm »

Threads merged and un-marked.
Logged

PlymWS

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 11
Re: Change to lastup mainpage content window
« Reply #8 on: March 26, 2007, 03:32:27 pm »

SOLVED, FINALLY !

Changed the second $query to read :
Code: [Select]
$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 ctime >= UNIX_TIMESTAMP( DATE_SUB( CURDATE( ) , INTERVAL 5 DAY ) ) AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 15 queries.