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
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=13I 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.
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:)
newbb don't assign datetime with normal format.
This is some kind of bug, I think.
So, I use xhnewbb.
o.k. where can I get it?
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.
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
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 ?
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;
}
?>