PEAK XOOPS - customize the date in englishin japanese

customize the date

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/6 22:14
eagle  办霹始   Posts: 13
Hi

First sorry for my french english

I had modify the file phpdate.js to have the date like this :

6 /06
5 /06
4 /06

what i want is to have :

6/06
5/06
4/06

to color the date of today and also not have the space between 6 and /06

Thanks for your help ;)
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/8 3:59
GIJOE  黎扦烦菱   Posts: 4110
about color:

edit the template of xhld*_*.html
or change the format in preferences


about space:

If you've already edited phpdata.jp, I can't advise you.
It's just an issue of JavaScript.


Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/8 4:16
eagle  办霹始   Posts: 13
Hi
here is the jscript:
function phpDate(format)
{
	var format_string = new String(format);

	// The timestamp parameter is optional; its absence is interpreted as "now".
	var date = (arguments.length >= 2) ? new Date(arguments[1] * 1000) : new Date();

	var pre = '<u><b><i>';    // prefix for highlighting unsupported code
	var suf = '</i></b></u>'; // suffix for highlighting unsupported code
	var rtn = '';             // return value
	var x, y;                 // temporaries

	for (var i = 0; i < format_string.length; ++i) {

		var format_char = format_string.charAt(i);

		switch (format_char) {

			default: // Pass through unrecognized characters in the format string as-is.
				rtn += format_char;
				break;

			case '\\': // Pass through following character as-is.
				++i;
				rtn += format_string.charAt(i);
				break;


			case 'a':
				x = date.getHours();
				rtn += x >= 12 ? 'pm' : 'am'; 
				break;

			case 'A':
				x = date.getHours();
				rtn += x >= 12 ? 'PM' : 'AM'; 
				break;

			case 'B':
				x = Math.floor(((((date.getUTCHours() + 1) % 24) * 60 + date.getUTCMinutes()) * 60 + date.getUTCSeconds()) / 86.4);
				rtn += x < 10 ? '00' + x : (x < 100 ? '0' + x : x);
				break;
				
			case 'd':
				x = date.getDate();
				rtn += x < 10 ? '0' + x : x;
				break;

			case 'D':
				x = date.getDay();
				y = new Array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');
				rtn += y[x];
				break;

			case 'F':
				x = date.getMonth();
				y = new Array('/01','/02','03','/04','/05','/06','/07','/08','/09','/10','/11','/12');
				rtn += y[x];
				break;

			case 'g':
				x = date.getHours();
				rtn += x > 12 ? x - 12 : x;
				break;

			case 'G':
				rtn += date.getHours();
				break;

			case 'h':
				x = date.getHours();
				y = x > 12 ? x - 12 : x;
				rtn += y < 10 ? '0' + y : y;
				break;

			case 'H':
				x = date.getHours();
				rtn += x < 10 ? '0' + x : x;
				break;

			case 'i':
				x = date.getMinutes();
				rtn += x < 10 ? '0' + x : x;
				break;

			case 'I': // unsupported
				rtn += pre + format_char + suf;
				break;

			case 'j':
				rtn += date.getDate();
				break;

			case 'l':
				x = date.getDay();
				y = new Array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');
				rtn += y[x];
				break;

			case 'L':
				x = date.getFullYear();
				rtn += (x % 400 == 0) || ((x % 4 == 0) && (x % 100 != 0)) ? 1 : 0;
				break;

			case 'm':
				x = date.getMonth() + 1;
				rtn += x < 10 ? '0' + x : x;
				break;

			case 'M':
				x = date.getMonth();
				y = new Array('/01','/02','03','/04','/05','/06','/07','/08','/09','/10','/11','/12');
				rtn += y[x];
				break;

			case 'n':
				rtn += date.getMonth() + 1;
				break;

			case 'O':
				var sign, hours, minutes;
				x = date.getTimezoneOffset();
				y = Math.abs(x);
				sign = x <= 0 ? '+' : '-'; // sign is reversed for consistency with PHP
				hours = Math.floor(y / 60);
				hours = new String(hours < 10 ? '0' + hours : hours);
				minutes = y % 60;
				minutes = new String(minutes < 10 ? '0' + minutes : minutes);
				rtn += sign + hours + minutes;
				break;

			case 'r':
				rtn += phpDate('D, j/ M Y H:i:s O', Math.floor(date.getTime() / 1000)); // recursive call
				break;

			case 's':
				x = date.getSeconds();
				rtn += x < 10 ? '0' + x : x;
				break;

			case 'S':
				x = date.getDate();
				y = new Array(
					'st','nd','rd','th','th','th','th','th','th','th',
					'th','th','th','th','th','th','th','th','th','th',
					'st','nd','rd','th','th','th','th','th','th','th',
					'st'
				);
				rtn += y[x - 1];
				break;

			case 't':
				x = date.getFullYear();
				y = new Array(31,0,31,30,31,30,31,31,30,31,30,31);
				y[1] = (x % 400 == 0) || ((x % 4 == 0) && (x % 100 != 0)) ? 29 : 28;
				rtn += y[date.getMonth()];
				break;

			case 'T': // unsupported
				rtn += pre + format_char + suf;
				break;

			case 'U':
				rtn += Math.floor(date.getTime() / 1000);
				break;

			case 'w':
				rtn += date.getDay();
				break;

			case 'W':
				x = new Date(date.getFullYear(), 0, 1); // date at beginning of current year
				rtn += Math.floor((date - x) / (7 * 24 * 60 * 60 * 1000)) + 1;
				break;

			case 'Y':
				rtn += date.getFullYear();
				break;

			case 'y':
				x = new String(date.getFullYear());
				rtn += x.substr(2, 2); 
				break;

			case 'z':
				x = new Date(date.getFullYear(), 0, 1); // date at beginning of current year
				rtn += Math.floor((date - x) / (24 * 60 * 60 * 1000));
				break;

			case 'Z':
				rtn += -date.getTimezoneOffset() * 60;
				break;
		}
	}

	return rtn;
}

for the template which one of them, specialy that i want to color only the date of the day.
here is the code :
<script type="text/javascript" src="<{$mod_url}>/phpdate.js"></script>
<h4 style="text-align:left;"><{$lang_headlines}></h4>
<div style='padding: 1px; text-align: left;'>
<table width="100%">
  <tr>
    <!-- start site loop -->
    <{foreach item=site from=$feed_sites}>
      <td>
        <{if $site.syndication == 'ATOM' }>
          <img src="images/atom.gif" /> 
        <{else}>
          <img src="images/rss.gif" /> 
        <{/if}>
        <a href="<{$mod_url}>/index.php?id=<{$site.id}>"><{$site.name}></a>
      <{cycle values="</td>,</td></tr><tr>"}>
    <{/foreach}>
    <!-- end site loop -->
  </tr>
</table>
</div>

<hr>

<{if $headline}>
  <{$headline}>
<{else}>
  <h5><{$mixlist.lang_listtitle}></h5>
  <table width="100%">
    <{section name=i loop=$mixlist.items max=$mixlist.maxitem}>
      <{if $mixlist.items[i].title != ""}>
        <tr class="<{cycle name=title values="even,odd"}>">

        <td nowrap="nowrap">
          <{if $mixlist.items[i].pubdate != ""}>
            <script type="text/javascript">document.write(phpDate('<{$mixlist.dtfmt_short|escape}>', <{$mixlist.items[i].pubdate|escape}>));</script>
            <noscript><{$mixlist.items[i].date_short|escape}></noscript>
          <{/if}>
        </td>

        <td><a href="<{$mixlist.items[i].link|escape}>" target="_blank"><b><{$mixlist.items[i].title|escape}></b></a></td>
        <td><a href="<{$mixlist.items[i].site_url|escape}>" target="_blank"><{$mixlist.items[i].site_name|escape}></a></td>

        </tr>

        <{if $smarty.section.i.index lt 10 }>
          <tr class="<{cycle name=desc values="even,odd"}>">
          <td></td>
          <td colspan="2"><{$mixlist.items[i].description}></td>
          </tr>
        <{/if}>

      <{/if}>
    <{/section}>
  </table>
<{/if}>

Thanks


edit: i've changed only the name of the mounth with the number of it
Votes:3 Average:0.00

question Re: customize the date

msg# 1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/9 4:06
GIJOE  黎扦烦菱   Posts: 4110
- Restore phpdate.js
- set n/d into xhld's preference as the format
- edit templates and insert <span style="color:red;"> and </span>
Votes:0 Average:0.00

question Re: customize the date

msg# 1.1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/9 6:08
eagle  办霹始   Posts: 13
Thanks
<span style="color:red;"> and </span> will color with red all my date, its possible to colorise only the date of the today?
Votes:0 Average:0.00

question Re: customize the date

msg# 1.1.1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/11 5:17
GIJOE  黎扦烦菱   Posts: 4110
Just add such logic into the JavaScript.
Votes:0 Average:0.00

question Re: customize the date

msg# 1.1.1.1.1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2006/6/11 6:15
eagle  办霹始   Posts: 13
Ok Im not realy friendly with it

Thanks
Votes:0 Average:0.00

question Re: customize the date

msg# 1.1.1.1.1.1.1.1
Previous post - Next post | Parent - No child | Posted on 2006/6/14 5:03
eagle  办霹始   Posts: 13
I leave this message, if some one found the solution one day contact me please
thanks :)
Votes:1 Average:10.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!