Change to lastup mainpage content window Change to lastup mainpage content window
 

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

Change to lastup mainpage content window

Started by PlymWS, March 13, 2007, 12:24:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PlymWS

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 ?

Joachim Müller

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

PlymWS

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.

jaiak


PlymWS


PlymWS

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 ?

PlymWS

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 ?

Joachim Müller


PlymWS

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";