|
Title: "New" text next to gallery name Post by: jeffpaulwilson on April 09, 2008, 03:18:04 AM 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!"? (http://www.residentweevil.com/tmp/rsgallery2question.JPG) Thanks, Jeff Title: Re: "New" text next to gallery name Post by: jeffpaulwilson on April 14, 2008, 03:20:04 AM Does anyone know if it is even possible to remove the "New!" under the config settings?
Title: Re: "New" text next to gallery name Post by: jeffpaulwilson on April 21, 2008, 02:57:44 AM I'm still kinda curious about this.
Title: Re: "New" text next to gallery name Post by: john on April 21, 2008, 01:38:14 PM 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 Title: Re: "New" text next to gallery name Post by: jeffpaulwilson on May 06, 2008, 01:51:09 AM 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! Title: Re: "New" text next to gallery name Post by: wogand on July 21, 2008, 09:52:07 AM 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(); } Title: Re: "New" text next to gallery name Post by: john on August 11, 2008, 09:05:07 AM 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 |