PEAK XOOPS - About "new" in englishin japanese

About "new"

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum

happy About "new"

msg# 1
Previous post - Next post | Parent - Children.1 | Posted on 2004/1/23 17:10
frenchman  °ìÅùʼ   Posts: 16
Hello again!
I see you've got the mark "new" in all blocks.
how did you do this?
I'd like it on my website:)
Thanks
Votes:0 Average:0.00

normal Re: About "new"

msg# 1.1
Previous post - Next post | Parent - Children.1 | Posted on 2004/1/24 5:08
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi frenchman.
Quote:
I see you've got the mark "new" in all blocks.
how did you do this?
I'd like it on my website:)
It is not a hack.
Add only a plugin into Smarty and use templates manager.
The plugin is ryus_date. (Ryuji's work)

download from here
http://ryus.biz/modules/mydownloads/singlefile.php?cid=3&lid=13

I translated into English
-------------------------------------------------------
Description:

This is a filtering plugin for Smarty.
This plugin can change the format of date, and/or can add "NEW".

First of all, download and extract the archive, and you'll get modifier.ryus_date.php.
Put modifier.ryus_date.php into class/smarty/plugins/


Usage:
This modifier can use variables assigned date or datetime in Template.

eg) if datetime is assigned in $topic.date:
-<{$topic.date|ryus_date}>
--No format is changed. Add "NEW" mark.
-<{$topic.date|ryus_date:"M"}>
--The datetime format is displayed like formatTimestamp( "M" )
-<{$topic.date|ryus_date:"S"}>
--The datetime format is displayed like formatTimestamp( "S" )
-<{$topic.date|ryus_date:"new"}>
--No datetime is not displayed, but shows only "NEW" mark.
-<{$topic.date|ryus_date:"Y-m-d"}>
--The datetime format is displayed like date( "Y-m-d" ). "NEW" mark is added.
-<{$topic.date|ryus_date:"j.n.Y":false}>
--The datetime format is displayed like date( "j.n.Y" ). "NEW" mark is not added.

Votes:0 Average:0.00

question Re: About "new"

msg# 1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2004/1/24 19:30
frenchman  °ìÅùʼ   Posts: 16
Quote:
GIJOE wrote:

download from here
http://ryus.biz/modules/mydownloads/singlefile.php?cid=3&lid=13

I translated into English
-------------------------------------------------------
Description:

This is a filtering plugin for Smarty.
This plugin can change the format of date, and/or can add "NEW".

First of all, download and extract the archive, and you'll get modifier.ryus_date.php.
Put modifier.ryus_date.php into class/smarty/plugins/

I downloaded this file and puted it into class/smarty/plugins

Quote:
GIJOE wrote:
Usage:
This modifier can use variables assigned date or datetime in Template.

eg) if datetime is assigned in $topic.date:
-<{$topic.date|ryus_date}>
--No format is changed. Add "NEW" mark.
-<{$topic.date|ryus_date:"M"}>
--The datetime format is displayed like formatTimestamp( "M" )
-<{$topic.date|ryus_date:"S"}>
--The datetime format is displayed like formatTimestamp( "S" )
-<{$topic.date|ryus_date:"new"}>
--No datetime is not displayed, but shows only "NEW" mark.
-<{$topic.date|ryus_date:"Y-m-d"}>
--The datetime format is displayed like date( "Y-m-d" ). "NEW" mark is added.
-<{$topic.date|ryus_date:"j.n.Y":false}>
--The datetime format is displayed like date( "j.n.Y" ). "NEW" mark is not added.

Where do I have to put this?
Sorry for such stupid questions:)
Votes:6 Average:0.00

normal Re: About "new"

msg# 1.1.1.1
Previous post - Next post | Parent - Children.1 .2 | Posted on 2004/1/25 5:54
GIJOE  ÀèǤ·³Áâ   Posts: 4110
Don't you know usage for XOOPS Template?

eg) how to edit the top new block of news

- copy template set from default to new name in template manager
- set default template set as the new template set in preferences
- edit news_block_new.html in the new template set in template manager
(don't edit original template file)
- change <{$news.date}> into <{$news.date|ryus_date}>
Votes:4 Average:10.00

question Re: About "new"

msg# 1.1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2004/1/26 16:44
frenchman  °ìÅùʼ   Posts: 16
And what abou newbb?
Votes:0 Average:0.00

normal Re: About "new"

msg# 1.1.1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2004/1/27 5:37
GIJOE  ÀèǤ·³Áâ   Posts: 4110
newbb don't assign datetime with normal format.
This is some kind of bug, I think.

So, I use xhnewbb.
Votes:0 Average:0.00

question Re: About "new"

msg# 1.1.1.1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2004/1/27 17:11
frenchman  °ìÅùʼ   Posts: 16
o.k. where can I get it?
Votes:0 Average:0.00

normal Re: About "new"

msg# 1.1.1.1.1.1.1.1
Previous post - Next post | Parent - No child | Posted on 2004/1/28 18:47
GIJOE  ÀèǤ·³Áâ   Posts: 4110
xhnewbb is only in CVS.
And I don't recommend it to anyone without developper.
You'd better hack the block or use another modules based on newbb.
Votes:0 Average:0.00

question Re: About "new"

msg# 1.1.1.1.2
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/9 20:53
efla  ¾åÅùʼ   Posts: 39
It's a nice tool, but I'm wondering how to interpret these 2 lines in the ruys_date.php script :

1*60*60*24 => ' <span class="new1">New!</span>',
7*60*60*24 => ' <span class="new2">New</span>'

What is 1*60*60*24 ? and 7*60*6Ž¨*24 ?

Thanks
Votes:0 Average:0.00

question Re: About "new"

msg# 1.1.1.1.2.1
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/10 0:17
efla  ¾åÅùʼ   Posts: 39
Ok, meanwhile I 've understood that we are speaking about seconds.
"1*60*60*24 " = 1 day
"7*60*60*24 " = 7 days

The problem for me is that the routine doesn't calculate well !

It think that perhaps the problem is coming from the fact that I'm using the European date format (dd-mm-yyyy) . so the date that is transmitted to the the script has that format. Perhaps does the script waiting for another date format ?


Votes:0 Average:0.00

normal Re: About "new"

msg# 1.1.1.1.2.1.1
Previous post - Next post | Parent - No child | Posted on 2005/4/10 5:31
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi efla.

This is a hacked version which has adaptation to both Y-m-d and d-m-Y.
(Of course, Y-n-j, Y/n/j, j-n-Y, j/n/Y are all OK).

But, short year (2 digits) and m-d-Y is no good.
That's because the script can't judge which field is year or month or date.


<?php
// $Id: modifier.ryus_date.php,v 1.1 2003/12/06 08:20:49 Ryuji Exp $
// FILE		::	modifier.ryus_date.php
// AUTHOR	::	Ryuji AMANO <info@joetsu.info>
// WEB		::	Ryu's Planning <http://ryus.joetsu.info/>
//

function smarty_modifier_ryus_date($string, $format="", $withNew = true)
{
	if($format != ""){
		switch($format){
		  case "M":
			$format = "n/j H:i";
			break;
		  case "S":
			$format = "n/j";
			break;
		  default:
		}
	}

	//global $xoopsUser;
	$now = xoops_getUserTimestamp(time(), "");

	if($string != '') {
		if( preg_match( '/^([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})(.*)$/' , $string , $matches ) ) {
			$time = strtotime( "{$matches[3]}-{$matches[2]}-{$matches[1]} {$matches[4]}" ) ;
		} else {
			$time = strtotime($string);
		}
	}else{
		return;
	}
	if($withNew){
		$NewMarks = array(
			1*60*60*24 => ' <span class="new1">New!</span>',
			7*60*60*24 => ' <span class="new2">New</span>'
			);

		$erapse = $now - $time;
		$new = "";
		foreach ($NewMarks as $limit=>$tag) {
			if ($erapse <= $limit){
				$new .= $tag;
				break;
			}
		}
	}else{
		$new = "";
	}
	if($format == ""){
		$retvar = $string . $new;
	}elseif(strtolower($format) == "new"){
		$retvar = $new;
	}else{
		$retvar = date($format, $time) . $new;
	}

	return $retvar;
}

?>
Votes:0 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!