Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 2 [3] 4

Author Topic: Timezone problem  (Read 16805 times)

Hoang, Nguyen Duc

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
    • http://kent.vnideadesign.com
Timezone problem
« Reply #30 on: September 20, 2006, 07:59:08 pm »

Hehe Great ! It could help you a bit Zu. I'm so happy to hear that. :D Go to bed now, have office tomorrow ;) Good night u guys..

p/s:
Quote
Only thing is that it capitalizes the begining of all words, even those I don't want to capitalize, but for now is good enough
;) Well, I don't think this should be a problem. Happy coding Zu
Logged
A signature is a small piece of text that is attached to your posts.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Timezone problem
« Reply #31 on: September 20, 2006, 08:20:45 pm »

Alternate Date Display Mod - ready for use (Spanish).
I see Bob is working on an alternative method for date display as well - great! In this one, I used a small jscript in a PHP function. Paste this new function into the top of your snews.php file, after the last of the language variables:
Code: [Select]
function datestring() { ?>

}
Then check all of the english month names for spanish spelling (I did a Google translation for the test-run). Note, in the line above // End -->, I already inserted the Spanish word del where it needs to be to display between the day and the year.

Test Display:
You can test-run this function by inserting the function-call statement anywhere in your index.php file - I stuck mine right before the pages() function-call on line 24... so it displays up in the top right corner of the home page (again, just to test that it works):
Code: [Select]
  Displaying in the Article Info Line: Replacing two strings within function center() (in snews.php) will display the Alternate date at the end of articles when the home page is viewed and again when the comments link is clicked. Line location numbers are in an un-touched, 'virgin' snews.php file (v1.5):

On line 482, find:
Quote
case ($tag == 'date'): echo $a_date_format; break;
and replace it with:
Quote
case ($tag == 'date'): echo datestring(); break;
On line 500, find:
Quote
case 'date': echo $a_date_format; break;
and replace it with:
Quote
case 'date': echo datestring(); break;
This mod is non-intrusive (not permanent) if you retain the original strings and just comment them out. Again, the new function uses javascript, as do 9 other functions grouped together at the bottom of the snews.php file. With some minor changes, the new function could easily be incorporated into the same group with the others.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #32 on: September 20, 2006, 10:41:28 pm »

Well, now we are talking!
This is what I call team Work :D

Thanks again Kent.
AgentSmith, I kind of try that, without success.

Quote from: Keyrocks
I took some time out on client projects for a spell to see if there was a simple way to do this with a small jscript enclosed in a PHP function
Key, That was so very sweet of you.  Now I feel in debt.  Thanks very MUCH!.  I will give a try tonight

Quote from: bakercad
from what I understand, in proper Spanish, months & days of the week are not supposed to be capitalized
I also read that, some place in the internet, but that is not what I was tough in school.  I will also try your solution tonight (Suddenly I have become a very experimental person)

... Is almost time for me to go home!
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #33 on: September 21, 2006, 04:20:39 am »

It worked great!
Quote from: keyrocks
...This mod is non-intrusive (not permanent) if you retain the original strings and just comment them out. ...
Is shows the date exactly the way I wanted and it is a lot easier that my original method ;) and is also easily reversible

Thanks again, again and again.
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #34 on: September 21, 2006, 04:55:58 am »

Quote from: bakercad
ok...I'm sure there's an easier way to do this, but to help you specifically.....

add this after setlocale (LC_ALL, 'es_ES','esp','es_ES@euro');
Your approach also worked wonderfully.  It is a great mod if the sNews team were to implement setlocale () to the stable version.  I think it would be an excellent addition, for it would make the system more appealing to those interested in using a language other than English.

On the other hand, Keyrock’s approach is a lot simpler to implement and less intrusive since It does not use selocale() and strftime().  Which would probable be very easy to incorporate to the sNews code using the variable in >Setting: “sNews Language:”  I wonder why haven’t they!  Am I the only person interested in using sNews in another language?
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Hoang, Nguyen Duc

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
    • http://kent.vnideadesign.com
Timezone problem
« Reply #35 on: September 21, 2006, 09:16:29 am »

I seem to be a robot w/o creativity :D I didn't think out an idea to solve ur problem :) Ive just read bakercad's approach and it's perfect! ;)
Logged
A signature is a small piece of text that is attached to your posts.

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Timezone problem
« Reply #36 on: September 21, 2006, 11:40:10 am »

Z, I know you've already found a solution to your problem, but I thought I'd test this out for my own satisfaction and here is an alternative to bakercad's solution.

Find
Quote
$a_date_format = strftime(s('date_format'), strtotime($r['date']));
for example in the center() function at around line 470 (in my slightly modded snews.php)
and replace with:
Quote
$a_date_format = date('l, d F Y, H:i T', strtotime($r['date']));
Note: this only takes care of the date formatting, it doesn't affect the language. The string outputs this date format (taken directly from my test page):
Quote
Read more * Comments (3) ? Saturday, 09 September 2006, 20:21 CEST
As I said, you may not need this now with all the solutions you've already been given, but it might be worth knowing about.

So, you see, I'm not so bad ... once you get to know me. ;D
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #37 on: September 21, 2006, 08:54:45 pm »

Quote from: agentsmith
As I said, you may not need this now with all the solutions you've already been given, but it might be worth knowing about.
So, you see, I'm not so bad ... once you get to know me. ;D
Now everything seems to be working fine.  Date is perfectly translated.  Time zone Implemented and a Fix applied to make the buttons functional.

Thanks to all for your kind help.  And Smith, I never though you were bad.  Just a bit confused :D :D
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Timezone problem
« Reply #38 on: September 21, 2006, 09:49:40 pm »

what? who? me? where? how? who? when? eh? nevermind? ok. :lol:
glad you got things sorted.
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #39 on: September 22, 2006, 02:24:15 am »

:D ... something like that.
Quote from: agentsmith
what? who? me? where? how? who? when? eh?
 Thanxs Smith
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Timezone problem
« Reply #40 on: September 22, 2006, 07:32:02 am »

steroids. has to be. how else could she slip away from us all the time like she does? But we'll get her one day... one day... ;D
Logged

disenando

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
    • http://www.aproxima.es
Timezone problem
« Reply #41 on: November 17, 2006, 12:34:28 am »

Hi all, your are very helpfull!

I installed 1.5RC2 on a production website (not sure if I did well), and am having the first problem Zucye mentions. I want my posts to appear in my timezone which is different from the server's. Does the solution for .htaccess work after I post a new article or before?

I also don't get the second solution to work, seconds are missing!

Thanks in advance,
Fernando

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #42 on: November 30, 2006, 06:02:50 pm »

Quote from: disenando
Does the solution for .htaccess work after I post a new article or before?
After..... I think....  it has been a while  :/  but after makes sence!
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Timezone problem
« Reply #43 on: November 30, 2006, 11:02:06 pm »

Not sure... but after seems to make sense to me too.
Hey Zukye...  Your "improved" Avatar is a welcome sight. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Timezone problem
« Reply #44 on: December 01, 2006, 03:05:54 am »

Hey Keyrocks is nice to get to say hello to you again.
I doubled check it.  It is definitely after!

Quote from: keyrocks
Your "improved" Avatar is a welcome site. :)
My avatar is a welcome site??  I don’t think I understood what you meant… sometimes I still get lost in translation :)
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)
Pages: 1 2 [3] 4