RSGallery2 Support Forums
Welcome, Guest. Please login or register.

Login with username, password and session length
  Home    Forum    Help    Search    Login    Register  
*
News : October 11, 2008, 07:42:56 AM
+  RSGallery2 Support Forums
|-+  RSgallery2 support forums
| |-+  Display and Templates (Moderators: Jonah, Tomislav Ribicic, Daniel Tulp, Ronald Smit)
| | |-+  "New" text next to gallery name
Advanced search
  « previous next »
Pages 1
Author
Topic: "New" text next to gallery name  (Read 4633 times)
« on: April 09, 2008, 03:18:04 AM »
jeffpaulwilson Offline
Newbie
*
Posts: 4

View Profile

My question is:
How do you remove the "New!" text next to the gallery name?  Or how do you set the length of time that it will say "New!"?



Thanks,
Jeff
Logged
 
Reply #1
« on: April 14, 2008, 03:20:04 AM »
jeffpaulwilson Offline
Newbie
*
Posts: 4

View Profile

Does anyone know if it is even possible to remove the "New!" under the config settings?
Logged
 
Reply #2
« on: April 21, 2008, 02:57:44 AM »
jeffpaulwilson Offline
Newbie
*
Posts: 4

View Profile

I'm still kinda curious about this.
Logged
 
Reply #3
« on: April 21, 2008, 01:38:14 PM »
john Offline
Dev Team
Sr. Member
*
Posts: 444

View Profile Email

Hi.

assuming you use the "semantic" template, you can remove the "New" in the file "templates/semantic/html/gallery.php" around line 35 by removing this:

Code:
<span class='rsg2-galleryList-newImages'>
<sup><?php if( $this->gallery->hasNewImages() ) echo _RSGALLERY_NEW?></sup>
</span>

the length of time is 7 days and not changeable in the control panel.
if you want to change it, modify "includes/gallery.class.php" around line 108:

Code:
function hasNewImages(){
$database =& JFactory::getDBO();
$lastweek  = mktime (0, 0, 0, date("m"),    date("d") - {put the days you want in here}, date("Y"));
$lastweek = date("Y-m-d H:m:s",$lastweek);
$database->setQuery("SELECT * FROM #__rsgallery2_files WHERE date >= '$lastweek' AND gallery_id = '{$this->id}' AND published = '1'");
$database->query();
return (bool) $database->getNumRows();
}

john
Logged
 
Reply #4
« on: May 06, 2008, 01:51:09 AM »
jeffpaulwilson Offline
Newbie
*
Posts: 4

View Profile

Thanks so much John.  Your solution worked like a charm.  I am a little confused though, because the "New" was there on all the galleries I had every created even the ones from months ago.  So I am not sure why they didn't go away after 7 days like they should have.

Thanks again!
Logged
 
Reply #5
« on: July 21, 2008, 09:52:07 AM »
wogand Offline
Newbie
*
Posts: 1

View Profile

Hi, Im having the problem that my albums will have the status "new" after 7 days. I'm using the semantic template.

The code I have is slightly different than above. Is something wrong in the code? Hope anyone can help me.

Code:
function hasNewImages(){
global $database;
$lastweek  = mktime (0, 0, 0, date("m"),    date("d") - 7, date("Y"));
$lastweek = date("Y-m-d H:m:s",$lastweek);
$database->setQuery("SELECT COUNT(1) FROM #__rsgallery2_files WHERE date >= '$lastweek' AND gallery_id = '{$this->id}'");
$database->query();
return (bool) $database->getNumRows();
}
Logged
 
Reply #6
« on: August 11, 2008, 09:05:07 AM »
john Offline
Dev Team
Sr. Member
*
Posts: 444

View Profile Email

I guess date overflow is not checked doing it this way ...

I could not find any information how PHP handles negative day values for the mktime function.

date_add and date_sub witch would be appropriate for this kind of coding are still in experimental state.

So basically, from my side there is no "simple" solution to this ... anybody ?

John
Logged
 
Print  Pages 1
« previous next »
Jump to: