coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: PlymWS on March 13, 2007, 12:24:06 PM

Title: Change to lastup mainpage content window
Post by: PlymWS 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 ?
Title: Re: Change to lastup mainpage content window
Post by: Joachim Müller 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.
Title: Re: Change to lastup mainpage content window
Post by: PlymWS 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.
Title: Re: Change to lastup mainpage content window
Post by: jaiak 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
Title: Re: Change to lastup mainpage content window
Post by: PlymWS on March 17, 2007, 12:42:31 PM
Many thanks jaiak
Title: Re: Change to lastup mainpage content window
Post by: PlymWS 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 :

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 ?
Title: Lastalb change required
Post by: PlymWS 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 :
$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 :
$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 ?
Title: Re: Change to lastup mainpage content window
Post by: Joachim Müller on March 26, 2007, 01:33:23 PM
Threads merged and un-marked.
Title: Re: Change to lastup mainpage content window
Post by: PlymWS on March 26, 2007, 03:32:27 PM
SOLVED, FINALLY !

Changed the second $query to read :
$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";