New items module

d3vlabs

Joined: 2005-05-10
Posts: 100
Posted: Sun, 2005-07-31 13:01

Using "New Items Module" in G2 modules.

Wondering the following. Right now the module shows "New!" as text, is it possible to replace it with an image, lets say new.gif. I tried grep-ing myself and editing the line yet it gave me a parse error. If you could give me a bit of guidance, I'd appreciate it

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-31 13:18

modules/newitems/module.inc

find

	$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>';
	    }
	}

replace by your own html.

with css / js you could replace the innerhtml of the giNew classes with an image. or just with css, you could set a background image .giNew. but it will still display the string over the background.
that's why you'll have to edit the source code...

 
d3vlabs

Joined: 2005-05-10
Posts: 100
Posted: Sun, 2005-07-31 14:06

This is what I tried:

$newString = $this->'<IMG SRC="http://www.mysite.net/img/new.gif">');
$updatedString = $this->translate('Updated');

Parse error: parse error, unexpected '<', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/d3v/public_html/mambo/g2/modules/newitems/module.inc on line 144

please give some hints vallaint :x

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-31 16:33

lol, sorry, but that code looks very funny :)
replace

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

with

$newString = '<img src="http://www.mysite.net/img/new.gif"/>';
   $updatedString = $this->translate('Updated');

maybe you also want to get rid of the <span> ... </span> around the <img .../> tag.

 
d3vlabs

Joined: 2005-05-10
Posts: 100
Posted: Sun, 2005-07-31 20:30

my code wasn't that off :roll:

thanks for both tips. replaced the text with image and removed the border. thanks once again.

 
virshu
virshu's picture

Joined: 2003-09-13
Posts: 314
Posted: Mon, 2005-08-01 21:25

d3vlabs, just FYI - it started as a gif. Then there was a request to have new/updated obey the language... that's when the gifs were out, and the text was in :) As my uncle used to say - new is well forgotten old

 
d3vlabs

Joined: 2005-05-10
Posts: 100
Posted: Mon, 2005-08-01 23:33

big ups to your uncle virshu

 
Lapinoo
Lapinoo's picture

Joined: 2004-05-08
Posts: 378
Posted: Tue, 2005-08-02 08:29

virshu,

I remember the problem. Could we maybe add some kind of graphical element with the text so that it looks less "raw" ?

 
d3vlabs

Joined: 2005-05-10
Posts: 100
Posted: Tue, 2005-08-02 09:37

the fix works just fine and takes a minute to apply. leave it as it is and focus on bigger issues :x

 
Lapinoo
Lapinoo's picture

Joined: 2004-05-08
Posts: 378
Posted: Wed, 2005-08-03 08:51

I agree, it is not a priority, but since Gallery represents a huge improvement on G1 as far as look and feel is concerned, it would be a shame not to expect the same quality from the modules (at least those provided with G2).

 
virshu
virshu's picture

Joined: 2003-09-13
Posts: 314
Posted: Thu, 2005-08-04 23:31

Lapinoo, I am complete idiot to decide what looks more or less "raw" or what look and feel is shameful. So, if you (or anybdody else) can suggest a CSS example of what you mean - I'll be happy to put it in (probably after release)...

 
Lapinoo
Lapinoo's picture

Joined: 2004-05-08
Posts: 378
Posted: Thu, 2005-08-04 23:37

virshu,

I was thinking of something like the image frames we use for albums and photos, some kind of graphical frame in which we could display some text (instead of a picture). That would be almost as nice as the original gif that was used, but this we can translate the text!
Anyway, this would not just be a CSS based solution, I don't know if there would be a problem to implement it.

 
d3vlabs

Joined: 2005-05-10
Posts: 100
Posted: Fri, 2005-08-05 02:27

what did I do....

 
Aktarus

Joined: 2005-08-07
Posts: 22
Posted: Sat, 2005-08-13 17:20

It would also be a good idea to use just a simple image border for new or edited images.
In my gallery I don't use picture frames and this way it would be nice to see a litte border around new or modified images.
Maybe the clolour can be defined using css.
[span class="giNew"][img src=".."][/span]