[SOLVED] Changing/Removing 'New'

richsulzmann

Joined: 2009-10-04
Posts: 12
Posted: Sun, 2009-10-04 13:46

Hi,

I have done a search on the forum and found some useful information about customizing.
I want to change the 'New' text under the images to a small graphic. I have managed to get rid of the box around the 'New' text, and have managed to add in the 'New' graphic so that this gets displayed.
Problem is the word 'New' is still displayed as well as the graphic, and when I remove the word the graphic goes too.
Current solution is to make the word 'New' the same colour as the background, but this has only sort of worked, as the attached JPG should show. Does anyone have any ideas as to how to display the graphic but not the text.

Any help much appreciated, thanks.

Regards,

Rich

AttachmentSize
Newproblem.jpg5.09 KB
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 22892
Posted: Sun, 2009-10-04 14:45

Edit modules/newitems/module.inc

    /**
     * @see GalleryModule::getItemSummaries
     */
    function getItemSummaries($items, $permissions, &$template) {
	list ($ret, $param) = GalleryCoreApi::fetchAllPluginParameters('module', 'newitems');
	if ($ret) {
	    return array($ret, null);
	}
	$time = time();
	$newTime = $time - $param['days.new'] * 86400;
	$updatedTime = $time - $param['days.updated'] * 86400;

	$newString = $this->translate('New');
	$updatedString = $this->translate('Updated');

	$summaries = array();
	foreach ($items as $item) {
	    if ($param['days.new'] > 0 && $item->getCreationTimestamp() > $newTime) {
		$summaries[$item->getId()] = '<span class="giNew">'
		    . $newString . '</span>';
	    } else if ($param['days.updated'] > 0
			&& $item->getModificationTimestamp() > $updatedTime) {
		$summaries[$item->getId()] = '<span class="giUpdated">'
		    . $updatedString . '</span>';
	    }
	}
	return array(null, $summaries);
    }

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sun, 2009-10-04 14:49

Edit modules/newitems/module.inc

Search for "newString" and "updatedString" and change them from:

        $newString = $this->translate('New');
        $updatedString = $this->translate('Updated');

to

        $newString = $this->translate('');
        $updatedString = $this->translate('');

NOTE: If you ever reinstall Gallery or just this module alone you'll need to make these changes again.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
richsulzmann

Joined: 2009-10-04
Posts: 12
Posted: Sun, 2009-10-04 16:06

Thanks for the replies. Unfortunately I had already tried this and it just removes the graphic as well as the text.

Rich

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sun, 2009-10-04 16:46

Dave beat me again :)

How are you putting the image in there?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
richsulzmann

Joined: 2009-10-04
Posts: 12
Posted: Sun, 2009-10-04 17:49

In themes/carbon/theme.css.....

.giNew {
  background-image: url('../carbon/images/new.gif');
  color: #3F3F3F;
}

.giUpdated {
  background-image: url('../carbon/images/updated.gif');
  color: #3F3F3F;
}

...instead of....

.giNew, .giUpdated {
  border-width: 1px;
  border-style: solid;
  padding: 0 6px;
  line-height: 1.9em;
}
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 22892
Posted: Sun, 2009-10-04 19:28

That should work then if you removed the text as in this post:
http://gallery.menalto.com/node/91602#comment-323149

Clear cache?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
richsulzmann

Joined: 2009-10-04
Posts: 12
Posted: Sun, 2009-10-04 21:14

Hi Dave,

When you say remove the text, do you mean completely removing the text highlighted in bold? I tried this and it didn't work.
Tried the cache too, still the same.
Bit of a puzzler I guess!

Rich

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 22892
Posted: Sun, 2009-10-04 21:58

Search for "newString" and "updatedString" and change them from:

        $newString = $this->translate('New');
        $updatedString = $this->translate('Updated');

to

        $newString = $this->translate('   ');
        $updatedString = $this->translate('   ');

Note: just remove the New and Updated

Then your css should work. If you see text then it is because of cache or you did not edit it right.
Post a URL to your site if you get stuck.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
richsulzmann

Joined: 2009-10-04
Posts: 12
Posted: Sun, 2009-10-04 23:31

Hi Dave,

I did this earlier and yes the text will disappear, but it also removes the graphic too so nothing is displayed.

Interestingly if I only have ('Ne') then only 2/3rds of the New graphic is displayed, and ('N') about 1/3rd of the graphic.

Site URL is http://www.southernrailwaypics.co.uk/gallery2/main.php

Rich

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 22892
Posted: Mon, 2009-10-05 01:11

Well since you are using a background image to a <span> tag that is empty then your background image will not show.
Change the text to be spaces or &nbsp;
or add some width the the span or margin might work as well.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 22892
Posted: Mon, 2009-10-05 01:20
 
richsulzmann

Joined: 2009-10-04
Posts: 12
Posted: Mon, 2009-10-05 03:11

Several &nbsp's has done the trick, ta!